{
  "openapi": "3.1.0",
  "info": {
    "title": "OpenTrain Public API",
    "version": "1.0.0",
    "description": "Programmatic access to the OpenTrain data-labeling marketplace for AI agents and integrations.\n\nAuthenticate every call with `Authorization: Bearer ot_pat_…`. Register and claim accounts per https://www.opentrain.ai/app/auth.md.\n\nConventions:\n- Errors use a uniform envelope `{error, code, requestId, details?}`.\n- Write surfaces are feature-flagged per account; `403 FEATURE_DISABLED`-style errors include details. Check `GET /capabilities`.\n- Identity-bearing writes (messaging, inviting, hiring) require a human-claimed account; unclaimed accounts get `403` with a `claimUrl`.\n- Money never moves from an API call alone: milestone fund/approve return `202` with an `approvalUrl` that a signed-in human must open and confirm. Contract ending never settles money and fails with `409` until every milestone is terminal. Poll `/updates` for `approval.confirmed` or re-check `GET /approvals/{approvalId}`.\n- Credits: accounts can hold a prepaid credit balance used for hires and milestone escrow. Top-ups return a Stripe Checkout `checkoutUrl` that a signed-in human must pay — the API call alone never charges anything, and co-sign approvals still apply to every money move.\n- Scopes: `jobs:read/write`, `proposals:read/write`, `messages:read/write`, `payments:read/write`, `team:read/write`, `time:read/write`, `tokens:read/write`, `instructions:read/write`, `project_todos:read/write`, `lms:read/write`, `videos:read/write`, and explicit-mint-only `videos:download`. Except for the explicit download scope, a `:write` scope implies `:read` for the same resource.\n- A missing scope is `403 FORBIDDEN` (`Insufficient scope`) with `details.requiredScopes` (any one suffices), `details.grantedScopes`, `details.accessMode`, `details.missingScopeReason` (`fine_grained_missing` | `explicit_mint_only` | `restricted_not_granted` | `restricted_add_on_ineligible` | `operator_only` | `worker_lane_only` | `worker_scope_retired` | `employer_lane_only` | `worker_fixed_policy` | `device_token`) and `details.remediation`: the one remedy that works for this key (for a fine-grained key, add the permission to the same key or switch it to Full access; the secret never changes), or null when none exists. A key's policy is edited only in Developer Settings; the API, CLI and MCP can never widen it.\n- Time tracking: worker-side reads/writes cover only the token owner's own time. Paired desktop devices authenticate with DEVICE-kind tokens that work ONLY on the `/time*` endpoints — any other endpoint returns `403` with `details.reason = TOKEN_KIND_NOT_ALLOWED`."
  },
  "servers": [
    {
      "url": "https://www.opentrain.ai/app/api/public/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "auth",
      "description": "Token identity"
    },
    {
      "name": "hub",
      "description": "Contributable Hub: the open registry of datasets, RL environments, evals, and benchmarks — every entry launchable into paid human work. HF-compatible reads live under /hf (set HF_ENDPOINT)."
    },
    {
      "name": "discovery",
      "description": "Capability discovery"
    },
    {
      "name": "model-programs",
      "description": "Model Programs (Step 33): persistent versioned model efforts — passes reference training runs (rails or external), checkpoints, and human evals; cross-pass comparison on shared evaluations."
    },
    {
      "name": "workflow-runs",
      "description": "Specialist-model loops (Step 33): define → env → trajectories → train → evaluate → serve over the existing rails; SEMI auto-orchestration parks at spend/work boundaries."
    },
    {
      "name": "engagements",
      "description": "Integrate marketplace (Step 32): implementation engagements — a thin read layer over Contract/Milestone; money moves only through the existing co-signed milestone routes."
    },
    {
      "name": "agencies",
      "description": "Integrate directory (Step 32): the public catalog of AI-implementation agencies — searchable, claimable, with tier-based visibility."
    },
    {
      "name": "deployments",
      "description": "Deploy (Step 32): serve a trained model as a managed, metered endpoint — orchestrate-don't-host over the buyer's own provider key (OpenTrain owns no GPU and runs no inference). Usage cost is record-only until billing go-live."
    },
    {
      "name": "operator",
      "description": "The delivery-operator plane (Step 30 rebuild): run a data company on OpenTrain rails — funnel, client-attributed projects, the competitive-pilot production gate, hired-network roster, record-only fees."
    },
    {
      "name": "capture",
      "description": "Open Capture: embodied capture sessions/episodes (Step 39) plus camera/NVR/VMS capture sources (C4 rebuild) — frames land in datasets content-deduped with capture lineage. Cameras on private LANs pair a local Capture Agent; reachable sources capture server-side."
    },
    {
      "name": "exports",
      "description": "Open Label project exports: 16 formats incl. training-ready SFT/DPO/PRM/KTO/PREFERENCE/VERIFIERS JSONL; async start → open_label.export.completed webhook → one-GET download."
    },
    {
      "name": "open-label",
      "description": "Open Label data catalog (Step 28): explore/semantic-search/duplicates/health/clusters over project assets, saved slices with live match counts, and immutable content-hashed dataset version snapshots with diffs."
    },
    {
      "name": "evaluate",
      "description": "Human evaluation: one-call launch, attach model outputs (any model — yours or ours; optional TrainingRun linkage), blind grading, BT leaderboard + gates."
    },
    {
      "name": "compute",
      "description": "Training runs: launch on a roster provider (BYOK pass-through) or register runs trained on your own stack (Step 19-ext); tuned-model eval-handoff into human evaluation."
    },
    {
      "name": "jobs",
      "description": "Public job catalog + jobs owned by the token account"
    },
    {
      "name": "job-drafts",
      "description": "Draft import, gap-filling, and publish readiness"
    },
    {
      "name": "proposals",
      "description": "Candidate proposals on owned jobs"
    },
    {
      "name": "freelancers",
      "description": "Public freelancer profiles"
    },
    {
      "name": "candidate-dossier",
      "description": "Privacy-safe proposal-linked candidate dossiers: aggregate + pageable reviews and contract history (DEV-2498, default-off agent surface)"
    },
    {
      "name": "admin-balance-hire",
      "description": "Admin-balance hire + milestone creation for verified OpenTrain admins (canonical admin organization members or the named platform admin; DEV-2494, default-off agent surface). Creation moves zero money; milestone approval/release stays human-only and has no agent operation."
    },
    {
      "name": "contract-offboarding",
      "description": "Canonical access-first contract offboarding. A zero-write owner-only preflight inventories everything the confirm will revoke, close, or preserve. Confirm requires reason, idempotency key, explicit confirmation, and the signed plan token; stale or unauthorized requests fail closed before mutation. Once authorized, it revokes local participation immediately regardless of unsettled earned payments, converges provider/Project To-do/LMS/manual cleanup with durable evidence, preserves all history, and advances to OFFBOARDED_PAYABLE. Cleanup failures leave access revoked in retryable OFFBOARDING. OFFBOARDED_PAYABLE is reported as `lifecycleStatus: CLOSING` (preflight, confirm and lifecycle carry `lifecycleStatus` ACTIVE | CLOSING | ENDED). Final CLOSED is settlement-gated and happens one of two ways (DEV-3066): when the preflight fields `automaticClose.enabled` and `automaticClose.eligible` are both true, the contract ends by itself, once, after its last open payment settles through the existing human-approved paths; otherwise the owner ends it with `POST /contracts/{contractId}/close` after settlement. No payment can be added after the contract ends. The owner clears a stale review flag on a completed, transferred milestone with `POST /contracts/{contractId}/milestones/{milestoneId}/review-flag/clear` (no money moves; audited). Financial blockers carry an `actionUrl` and pending approvals an `approvalUrl` for the signed-in human; human co-sign remains required where policy demands it. It never sends chat, touches proposals, and moves no money."
    },
    {
      "name": "messaging-management",
      "description": "Agent-first channel, thread, reaction, pin, and soft-moderation management (DEV-2500, default-off). No archive, hard-delete, ban/report, mute, or DM-conversion operations."
    },
    {
      "name": "project-todos",
      "description": "Opt-in per-job continuous Project To-do lists: employer authoring/review + worker effective lists with immutable versions, evidence, and append-only audit (DEV-2504, default-off agent surface)"
    },
    {
      "name": "job-integrations",
      "description": "Provider-neutral job time-tracker/project-action integrations (Hubstaff today): masked status/config, contract provisioning, and fail-closed reconciliation. Credentials never appear on this surface. Distinct from the Open Interop labeling-tool routes (DEV-2504, default-off agent surface)"
    },
    {
      "name": "talent",
      "description": "Employer-only vetted talent discovery: search + portable reputation (aggregate-only)"
    },
    {
      "name": "pilots",
      "description": "Competitive pilot rounds: identical-sample supplier bake-offs scored on the same basis"
    },
    {
      "name": "open-contributions",
      "description": "Open contribution programs: unpaid open work whose accepted, reviewed units build a public, portable track record"
    },
    {
      "name": "messages",
      "description": "Conversations and messages"
    },
    {
      "name": "contracts",
      "description": "Post-hire contracts and milestones"
    },
    {
      "name": "approvals",
      "description": "Human co-sign approvals for money-moving requests"
    },
    {
      "name": "payments",
      "description": "Payment state"
    },
    {
      "name": "credits",
      "description": "Prepaid credit balance, ledger, and top-ups"
    },
    {
      "name": "collection",
      "description": "Paid crowdsourced DATA_COLLECTION programs: per-item pricing, escrowed budget caps, screened + reviewed contributions, per-contribution payout accrual"
    },
    {
      "name": "envs",
      "description": "RL environment construction marketplace: certified env listings with instant licensing, escrowed commissions and bounties, hosted trial sessions, and public certification reports"
    },
    {
      "name": "gigs",
      "description": "Agent-dispatched human gigs: a vetted human answers VERIFY/VALIDATE/JUDGE/FILL tasks; results release only after independent review"
    },
    {
      "name": "verify",
      "description": "Verify Gateway (Step 34-D): one programmatic front door — push model outputs (rows, episodes, run imports, agent trajectories) and get human verdicts back. Record-only pricing until money-go; requires the verify_gateway rollout + verify:read/write scopes."
    },
    {
      "name": "benchmarks",
      "description": "Community benchmark marketplace: expert-authored held-out test sets. Labs buy access and run models via the run-but-don't-see harness — aggregate scores + CIs come back, never case bodies, case hashes or per-case verdicts."
    },
    {
      "name": "updates",
      "description": "Delta feed of account events"
    },
    {
      "name": "webhooks",
      "description": "Push delivery of platform events to subscriber URLs"
    },
    {
      "name": "team",
      "description": "Workspace team management"
    },
    {
      "name": "time",
      "description": "Time tracking: entries, heartbeats, devices, summaries"
    },
    {
      "name": "tokens",
      "description": "API token management"
    },
    {
      "name": "instructions",
      "description": "Agent-first rich instruction documents: nested manuals, canonical TipTap JSON, atomic changesets, immutable revisions/publications, and private media."
    },
    {
      "name": "lms",
      "description": "Standalone organization Training/LMS courses, immutable versions, Native Forms assessments, private media, and Project To-do assignment status.",
      "x-opentrain-tracking": {
        "taskKey": "DEV-2674",
        "taskId": "86d44utef"
      }
    },
    {
      "name": "agreements",
      "description": "OpenTrain Agreements (native e-signature, DEV-4365): create agreement documents, upload their PDF through a signed PUT, place signature fields, preview pages through short-lived resource handles, and publish immutable versions. Behind the agreements_native rollout."
    },
    {
      "name": "job-checklists",
      "description": "Adaptive per-job Task Checklists (DEV-3032 over the DEV-2968 domain): full authoring parity with the web builder — complete-atomic create, CAS draft saves, exact-rule no-write validate/resolve, confirmed double-CAS publish with applied impact + sweep counts, immutable versions, privacy-filtered submissions, strict reorder, worker-visibility toggle, and stateless revision-exact browser preview grants."
    },
    {
      "name": "job-feedback",
      "description": "Job-scoped reviewer feedback (DEV-3032 over the DEV-2968 domain): employer-only person-focused operations records — list/search, full detail with append-only event history, authoritative summaries, employer-authored submit, CAS-fenced triage, legacy subject reconciliation, reviewer-access management, subject-roster discovery, and the confirmed per-job toggle. Privacy-sensitive: subjects never read feedback, author identity, severity, notes, history, or counts through any agent surface."
    },
    {
      "name": "job-operations",
      "description": "Shared job operations context: an always-on, per-job coordination plane with an evidence-backed snapshot, revision-cursor delta stream, durable decisions/observations, coordinated actions with leases, checkpoints, and structured handoffs. Context-first protocol: read context, triage, claim, act against canonical records, verify, hand off.",
      "x-opentrain-tracking": {
        "taskKey": "DEV-2823"
      }
    },
    {
      "name": "video-library",
      "description": "Shared organization video library: upload once via a one-time direct-to-provider TUS grant, reuse across Instructions pages, LMS lessons, and messages via draft placement references, and mint audited short-lived MP4-rendition download grants. Video bytes never travel through this API and provider identifiers are never exposed. Default-dark family: while the environment flag is off every call returns 403 AGENT_SURFACE_DISABLED.",
      "x-opentrain-tracking": {
        "taskId": "86d4623g3"
      }
    }
  ],
  "paths": {
    "/messages/route-candidate": {
      "get": {
        "operationId": "resolveCandidateMessageRoute",
        "summary": "Resolve current candidate message route",
        "description": "Resolve the existing DM for a proposal (optionally jobId), or jobId plus userId. Requires messages:read and employer job/conversation access. Current ACTIVE/REACTIVATED participation routes to Job DM; no current hire routes to Proposal DM, never historical HIRED. Missing/ambiguous state refuses. Read the conversation before sending; preserve the complete route for opentrain_send_candidate_message. Never creates or repairs conversations.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "proposalId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved route or idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "route": {
                      "type": "object",
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "proposalId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "contractId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "contractState": {
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "ENDED",
                            "NONE"
                          ]
                        },
                        "conversationType": {
                          "type": "string",
                          "enum": [
                            "JOB_DM",
                            "PROPOSAL_DM"
                          ]
                        },
                        "conversationId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "visibleInEmployerInbox": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "CURRENT_ACTIVE_HIRE",
                            "NO_CURRENT_HIRE"
                          ]
                        },
                        "revision": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        }
                      },
                      "required": [
                        "jobId",
                        "proposalId",
                        "userId",
                        "contractId",
                        "contractState",
                        "conversationType",
                        "conversationId",
                        "visibleInEmployerInbox",
                        "reason",
                        "revision"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "route"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Route missing, ambiguous, inconsistent, or changed; review before retrying."
          }
        }
      }
    },
    "/messages/send-candidate": {
      "post": {
        "operationId": "sendCandidateMessage",
        "summary": "Send to a reviewed candidate route",
        "description": "Send once to an existing reviewed candidate DM. Pass the complete route from opentrain_resolve_candidate_message_route, content, confirm:true and a stable idempotencyKey. Requires messages:read/write, messaging rollout and claimed employer access. Hire state and latest root/thread message are rechecked atomically; stale or ambiguous routes refuse without sending. Never silently reroutes or duplicates. After an uncertain outcome retry only the SAME route, content and key; never auto-refresh or use a new key. Returns the route, messageId and replayed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "route": {
                    "type": "object",
                    "properties": {
                      "jobId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "proposalId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "userId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "contractId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "contractState": {
                        "type": "string",
                        "enum": [
                          "ACTIVE",
                          "ENDED",
                          "NONE"
                        ]
                      },
                      "conversationType": {
                        "type": "string",
                        "enum": [
                          "JOB_DM",
                          "PROPOSAL_DM"
                        ]
                      },
                      "conversationId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "visibleInEmployerInbox": {
                        "type": "boolean"
                      },
                      "reason": {
                        "type": "string",
                        "enum": [
                          "CURRENT_ACTIVE_HIRE",
                          "NO_CURRENT_HIRE"
                        ]
                      },
                      "revision": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "jobId",
                      "proposalId",
                      "userId",
                      "contractId",
                      "contractState",
                      "conversationType",
                      "conversationId",
                      "visibleInEmployerInbox",
                      "reason",
                      "revision"
                    ],
                    "additionalProperties": false
                  },
                  "content": {
                    "type": "string",
                    "minLength": 1
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "allowLiteralEscapes": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "route",
                  "content",
                  "idempotencyKey",
                  "confirm"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resolved route or idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "route": {
                      "type": "object",
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "proposalId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "contractId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "contractState": {
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "ENDED",
                            "NONE"
                          ]
                        },
                        "conversationType": {
                          "type": "string",
                          "enum": [
                            "JOB_DM",
                            "PROPOSAL_DM"
                          ]
                        },
                        "conversationId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "visibleInEmployerInbox": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "CURRENT_ACTIVE_HIRE",
                            "NO_CURRENT_HIRE"
                          ]
                        },
                        "revision": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        }
                      },
                      "required": [
                        "jobId",
                        "proposalId",
                        "userId",
                        "contractId",
                        "contractState",
                        "conversationType",
                        "conversationId",
                        "visibleInEmployerInbox",
                        "reason",
                        "revision"
                      ],
                      "additionalProperties": false
                    },
                    "messageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "route",
                    "messageId",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "Message committed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "route": {
                      "type": "object",
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "proposalId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "userId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "contractId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "contractState": {
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "ENDED",
                            "NONE"
                          ]
                        },
                        "conversationType": {
                          "type": "string",
                          "enum": [
                            "JOB_DM",
                            "PROPOSAL_DM"
                          ]
                        },
                        "conversationId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "visibleInEmployerInbox": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "CURRENT_ACTIVE_HIRE",
                            "NO_CURRENT_HIRE"
                          ]
                        },
                        "revision": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        }
                      },
                      "required": [
                        "jobId",
                        "proposalId",
                        "userId",
                        "contractId",
                        "contractState",
                        "conversationType",
                        "conversationId",
                        "visibleInEmployerInbox",
                        "reason",
                        "revision"
                      ],
                      "additionalProperties": false
                    },
                    "messageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "route",
                    "messageId",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Route missing, ambiguous, inconsistent, or changed; review before retrying."
          }
        }
      }
    },
    "/jobs/{jobId}/hire-batches": {
      "post": {
        "operationId": "createHireBatch",
        "summary": "Request one batch hire approval",
        "description": "Request one human approval for 1–20 same-job applicants. Never hires or funds directly. Initial hire uses the bid; another requested rate needs worker acceptance. Stable key required; human edits/deselects/confirms at approvalUrl. POST replays its receipt; GET reads current status. Distinct pending reviews per actor and job are capped (409 PENDING_BATCH_LIMIT with limit and pendingCount); a slot frees when the human confirms or declines one, or when retention declines one left expired for 90 days.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "defaults": {
                    "type": "object",
                    "properties": {
                      "rateUsd": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      "milestone": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "maxLength": 500
                          },
                          "description": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "amount": {
                            "type": "number",
                            "exclusiveMinimum": 0,
                            "maximum": 1000000
                          },
                          "volume": {
                            "type": "number",
                            "exclusiveMinimum": 0,
                            "maximum": 1000000
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  "items": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "proposalId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "rateUsd": {
                          "type": "number",
                          "exclusiveMinimum": 0,
                          "maximum": 1000000
                        },
                        "milestone": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "description": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "amount": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 1000000
                            },
                            "volume": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 1000000
                            },
                            "dueDate": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "additionalProperties": false
                        },
                        "confirmNotFitOverride": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "proposalId"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "idempotencyKey",
                  "items"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Human review link. No funds, holds or contracts created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "batchId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "approvalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "approvalUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "statusUrl": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "required": [
                    "batchId",
                    "approvalId",
                    "approvalUrl",
                    "expiresAt",
                    "statusUrl"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "401": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "403": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "404": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "409": {
            "description": "Identity, reviewed set, eligibility or per-actor-and-job pending-review limit conflict (details.reason PENDING_BATCH_LIMIT carries limit and this actor's pendingCount on the job); preserve the original key on retry. A GET without the review-redaction capability on a redacted batch answers details.reason REVIEW_REDACTED."
          },
          "413": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "503": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          }
        }
      }
    },
    "/hire-batches/{batchId}": {
      "get": {
        "operationId": "getHireBatch",
        "summary": "Read batch hire progress",
        "description": "Read every original item outcome, contract mapping and pending rate consent. Observational: never confirms, funds, expires or resumes work.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-opentrain-hire-batch-capabilities",
            "in": "header",
            "required": false,
            "description": "Send `review-redaction` to read a batch whose current review was redacted under the 90-day retention rule: `review` is then null and `redaction` holds the tombstone. Without it a redacted batch answers 409 CONFLICT details.reason REVIEW_REDACTED, so strict clients that expect a review never get null.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current progress, including all original applicants and per-item failures.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "batchId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "approvalId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "jobId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "approvalUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "evaluatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "executionExpiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "AWAITING_REVIEW",
                        "QUEUED",
                        "RUNNING",
                        "COMPLETED",
                        "COMPLETED_WITH_ERRORS",
                        "RECOVERY_REQUIRED",
                        "DECLINED",
                        "EXPIRED"
                      ]
                    },
                    "confirmedRevision": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "exclusiveMinimum": 0
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "review": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "revision": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            },
                            "digest": {
                              "type": "string",
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "fundingSource": {
                              "type": "string",
                              "enum": [
                                "CARD",
                                "CREDITS",
                                "ADMIN_BALANCE"
                              ]
                            },
                            "fundingAvailable": {
                              "type": "boolean"
                            },
                            "availableFundingSources": {
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "CARD",
                                  "CREDITS",
                                  "ADMIN_BALANCE"
                                ]
                              }
                            },
                            "principalCents": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "feeCents": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "totalCents": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "items": {
                              "minItems": 1,
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "proposalId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  },
                                  "input": {
                                    "type": "object",
                                    "properties": {
                                      "proposalId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      },
                                      "rateUsd": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 1000000
                                      },
                                      "milestone": {
                                        "type": "object",
                                        "properties": {
                                          "name": {
                                            "type": "string",
                                            "maxLength": 500
                                          },
                                          "description": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "amount": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000000
                                          },
                                          "volume": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000000
                                          },
                                          "dueDate": {
                                            "type": "string",
                                            "format": "date-time"
                                          }
                                        },
                                        "additionalProperties": false
                                      },
                                      "confirmNotFitOverride": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "proposalId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "selected": {
                                    "type": "boolean"
                                  },
                                  "eligible": {
                                    "type": "boolean"
                                  },
                                  "eligibility": {
                                    "type": "string",
                                    "enum": [
                                      "ELIGIBLE",
                                      "ALREADY_HIRED",
                                      "NOT_A_FIT",
                                      "INVALID_TERMS"
                                    ]
                                  },
                                  "displayName": {
                                    "type": "string",
                                    "maxLength": 200
                                  },
                                  "bid": {
                                    "type": "object",
                                    "properties": {
                                      "rateUsd": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "paymentType": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 100
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "rateUsd",
                                      "paymentType"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "requestedRateUsd": {
                                    "anyOf": [
                                      {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 1000000
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "milestone": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "name": {
                                            "type": "string",
                                            "maxLength": 500
                                          },
                                          "description": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "amount": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000000
                                          },
                                          "volume": {
                                            "anyOf": [
                                              {
                                                "type": "number",
                                                "exclusiveMinimum": 0
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "dueDate": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "name",
                                          "description",
                                          "amount",
                                          "volume",
                                          "dueDate"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "confirmNotFitOverride": {
                                    "type": "boolean"
                                  },
                                  "principalCents": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "feeCents": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "totalCents": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "warnings": {
                                    "maxItems": 10,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "maxLength": 1000
                                    }
                                  }
                                },
                                "required": [
                                  "proposalId",
                                  "input",
                                  "selected",
                                  "eligible",
                                  "eligibility",
                                  "displayName",
                                  "bid",
                                  "requestedRateUsd",
                                  "milestone",
                                  "confirmNotFitOverride",
                                  "principalCents",
                                  "feeCents",
                                  "totalCents",
                                  "warnings"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "revision",
                            "digest",
                            "fundingSource",
                            "fundingAvailable",
                            "availableFundingSources",
                            "principalCents",
                            "feeCents",
                            "totalCents",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "redaction": {
                      "type": "object",
                      "properties": {
                        "revision": {
                          "type": "integer",
                          "exclusiveMinimum": 0
                        },
                        "digest": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "redactedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "proposalIds": {
                          "minItems": 1,
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "selectedCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 20
                        },
                        "totalCents": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "revision",
                        "digest",
                        "redactedAt",
                        "proposalIds",
                        "selectedCount",
                        "totalCents"
                      ],
                      "additionalProperties": false
                    },
                    "items": {
                      "minItems": 1,
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "proposalId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "NOT_SELECTED",
                              "QUEUED",
                              "RUNNING",
                              "HIRED",
                              "ALREADY_HIRED",
                              "NEEDS_REVIEW",
                              "FAILED",
                              "RECOVERY_REQUIRED"
                            ]
                          },
                          "contractId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "milestoneId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "fundingSource": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "CARD",
                                  "CREDITS",
                                  "ADMIN_BALANCE"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "totalCents": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "failure": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string",
                                    "enum": [
                                      "BID_CHANGED",
                                      "FUNDING_CHANGED",
                                      "NOT_A_FIT",
                                      "PAYMENT_UNAVAILABLE",
                                      "ACCESS_REVOKED",
                                      "CONSENT_EXPIRED",
                                      "HIRE_REFUSED",
                                      "HIRE_IN_PROGRESS",
                                      "HIRE_RECOVERY_REQUIRED",
                                      "WORK_UNAVAILABLE"
                                    ]
                                  },
                                  "message": {
                                    "type": "string",
                                    "maxLength": 300
                                  },
                                  "retryable": {
                                    "type": "boolean"
                                  },
                                  "nextAction": {
                                    "type": "string",
                                    "enum": [
                                      "REVIEW",
                                      "WAIT",
                                      "CONTACT_SUPPORT"
                                    ]
                                  }
                                },
                                "required": [
                                  "code",
                                  "message",
                                  "retryable",
                                  "nextAction"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "rate": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "requestedRateUsd": {
                                    "anyOf": [
                                      {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 1000000
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "initialRateUsd": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "outcome": {
                                    "type": "string",
                                    "enum": [
                                      "NOT_REQUIRED",
                                      "PENDING",
                                      "PROPOSED",
                                      "RESOLVED",
                                      "RECOVERY_REQUIRED",
                                      "FAILED"
                                    ]
                                  },
                                  "compensationChangeId": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "status": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "enum": [
                                          "PENDING",
                                          "ACCEPTED",
                                          "DECLINED",
                                          "APPEALED",
                                          "APPEAL_ACCEPTED",
                                          "SUPERSEDED",
                                          "CANCELED"
                                        ]
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "announcement": {
                                    "type": "string",
                                    "enum": [
                                      "NOT_REQUIRED",
                                      "PENDING",
                                      "DELIVERED",
                                      "RECOVERY_REQUIRED"
                                    ]
                                  }
                                },
                                "required": [
                                  "requestedRateUsd",
                                  "initialRateUsd",
                                  "outcome",
                                  "compensationChangeId",
                                  "status",
                                  "announcement"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "proposalId",
                          "status",
                          "contractId",
                          "milestoneId",
                          "fundingSource",
                          "totalCents",
                          "failure",
                          "rate"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "selected": {
                          "type": "integer"
                        },
                        "hired": {
                          "type": "integer"
                        },
                        "alreadyHired": {
                          "type": "integer"
                        },
                        "pending": {
                          "type": "integer"
                        },
                        "needsReview": {
                          "type": "integer"
                        },
                        "failed": {
                          "type": "integer"
                        },
                        "recoveryRequired": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "selected",
                        "hired",
                        "alreadyHired",
                        "pending",
                        "needsReview",
                        "failed",
                        "recoveryRequired"
                      ],
                      "additionalProperties": false
                    },
                    "partialSuccess": {
                      "type": "boolean"
                    },
                    "followUpPending": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "batchId",
                    "approvalId",
                    "jobId",
                    "approvalUrl",
                    "evaluatedAt",
                    "expiresAt",
                    "executionExpiresAt",
                    "status",
                    "confirmedRevision",
                    "review",
                    "items",
                    "counts",
                    "partialSuccess",
                    "followUpPending"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "401": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "403": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "404": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "409": {
            "description": "Identity, reviewed set, eligibility or per-actor-and-job pending-review limit conflict (details.reason PENDING_BATCH_LIMIT carries limit and this actor's pendingCount on the job); preserve the original key on retry. A GET without the review-redaction capability on a redacted batch answers details.reason REVIEW_REDACTED."
          },
          "413": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          },
          "503": {
            "description": "Bounded error envelope; no applicant or provider details are echoed."
          }
        }
      }
    },
    "/project-todos/quizzes/forms/{formId}/images": {
      "get": {
        "operationId": "projectTodoQuizFormImagesList",
        "tags": [
          "project-todos"
        ],
        "summary": "List the private authoring images of one job-scoped quiz form",
        "description": "List the private authoring images of one job-scoped quiz form, newest first (at most 100; truncated says more exist): status (PENDING until finalized, then READY), MIME type, size, dimensions and verified sha256. Employer-only: needs project_todos:write (list: project_todos:read), a claimed account and access to the form's job; a missing, foreign, other-job, archived or organization-level form is one 404. Images are private: no storage path or delivery URL is returned, and bytes never travel in a request body or as base64.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Form images, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "formId": {
                      "type": "string"
                    },
                    "images": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "assetId": {
                            "type": "string"
                          },
                          "formId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "PENDING",
                              "READY",
                              "EXPIRED"
                            ]
                          },
                          "contentType": {
                            "type": "string"
                          },
                          "byteSize": {
                            "type": "integer"
                          },
                          "widthPx": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "heightPx": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "fileName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sha256": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "assetId",
                          "formId",
                          "status",
                          "contentType",
                          "byteSize",
                          "widthPx",
                          "heightPx",
                          "fileName",
                          "sha256",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "formId",
                    "images",
                    "truncated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope, device token, project-todos agent surface off, or unclaimed agent account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form missing, foreign, other job, archived or organization-level (indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/forms/{formId}/images/prepare": {
      "post": {
        "operationId": "projectTodoQuizFormImagePrepare",
        "tags": [
          "project-todos"
        ],
        "summary": "Reserve a private quiz authoring image and mint a signed single-PUT grant",
        "description": "Quiz authoring image step 1/3 (registry op project_todos.quizzes.forms.images.upload): reserves a private image for a job-scoped quiz form (PNG, JPEG, WebP or GIF, at most 5 MiB) and returns a fresh signed single-PUT grant (2 h, upsert disabled). PUT the exact bytes to upload.signedPut.url with upload.signedPut.headers, then finalize. The same idempotencyKey replays the same reservation with a new grant. The grant is a SECRET: use it once, never store or log it. Employer-only: needs project_todos:write (list: project_todos:read), a claimed account and access to the form's job; a missing, foreign, other-job, archived or organization-level form is one 404. Images are private: no storage path or delivery URL is returned, and bytes never travel in a request body or as base64. Served `Cache-Control: private, no-store`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). The same key and payload replay the same reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contentType": {
                    "type": "string",
                    "enum": [
                      "image/png",
                      "image/jpeg",
                      "image/webp",
                      "image/gif"
                    ]
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5242880
                  },
                  "fileName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "contentType",
                  "sizeBytes",
                  "fileName"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Reservation and a fresh upload grant (null once READY)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "READY",
                        "RESERVED"
                      ]
                    },
                    "asset": {
                      "type": "object",
                      "properties": {
                        "assetId": {
                          "type": "string"
                        },
                        "formId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "READY",
                            "EXPIRED"
                          ]
                        },
                        "contentType": {
                          "type": "string"
                        },
                        "byteSize": {
                          "type": "integer"
                        },
                        "widthPx": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "heightPx": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "fileName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sha256": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "createdAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "assetId",
                        "formId",
                        "status",
                        "contentType",
                        "byteSize",
                        "widthPx",
                        "heightPx",
                        "fileName",
                        "sha256",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    "upload": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "expiresAt": {
                              "type": "string"
                            },
                            "signedPut": {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string"
                                },
                                "headers": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "type": "string"
                                  }
                                }
                              },
                              "required": [
                                "url",
                                "headers"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "expiresAt",
                            "signedPut"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "status",
                    "asset",
                    "upload",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid content type, size or file name, or a missing key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope, device token, project-todos agent surface off, or unclaimed agent account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form missing, foreign, other job, archived or organization-level (indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The key was used with a different payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Image larger than 5 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "INVALIDATED: the reservation expired or the key held another file",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Upload rate lane exhausted (typed RATE_LIMITED details)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Storage is unavailable; retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/forms/{formId}/images/{assetId}/finalize": {
      "post": {
        "operationId": "projectTodoQuizFormImageFinalize",
        "tags": [
          "project-todos"
        ],
        "summary": "Verify the uploaded image bytes server-side and commit the image READY",
        "description": "Quiz authoring image step 3/3: the server reads the stored bytes and checks the reserved size, magic bytes, dimensions, pixel count and SHA-256 (pass expectedSha256 to cross-check) before it commits the image READY. UPLOAD_INCOMPLETE means nothing is stored yet; CHECKSUM_MISMATCH leaves the reservation PENDING; INVALID bytes need a new reservation. Then put `imageNode` into a question's rich content in the draft (form_update_draft) and set `attrs.alt` to a short description, or `attrs.decorative: true` for an image that carries no meaning. The draft accepts only READY images of the same form or job. Employer-only: needs project_todos:write (list: project_todos:read), a claimed account and access to the form's job; a missing, foreign, other-job, archived or organization-level form is one 404. Images are private: no storage path or delivery URL is returned, and bytes never travel in a request body or as base64.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). The same key and payload replay the same reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedSha256": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified image and the rich-content node to reference",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asset": {
                      "type": "object",
                      "properties": {
                        "assetId": {
                          "type": "string"
                        },
                        "formId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "READY",
                            "EXPIRED"
                          ]
                        },
                        "contentType": {
                          "type": "string"
                        },
                        "byteSize": {
                          "type": "integer"
                        },
                        "widthPx": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "heightPx": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "fileName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sha256": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "createdAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "assetId",
                        "formId",
                        "status",
                        "contentType",
                        "byteSize",
                        "widthPx",
                        "heightPx",
                        "fileName",
                        "sha256",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    "imageNode": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "image"
                        },
                        "attrs": {
                          "type": "object",
                          "properties": {
                            "assetId": {
                              "type": "string"
                            },
                            "alt": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "decorative": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "assetId",
                            "alt",
                            "decorative"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "attrs"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "asset",
                    "imageNode",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid expectedSha256 or a missing key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope, device token, project-todos agent surface off, or unclaimed agent account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form missing, foreign, other job, archived or organization-level (indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_INCOMPLETE (nothing stored yet), VERIFICATION_FAILED (retry) or CHECKSUM_MISMATCH (reservation stays PENDING)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "INVALID bytes: the reservation is invalidated; start a new upload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Upload rate lane exhausted (typed RATE_LIMITED details)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Storage is unavailable; retry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/capabilities": {
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Discover canonical job Instructions capabilities",
        "description": "Returns the exact schema version, TipTap nodes and marks, patch operations, document and image limits, allowed image host patterns, tree depth, import guarantees, and write semantics supported by this API version. The mutations block is TRUTHFUL for the moment of the read: immediatelyWorkerVisible / workerVisibility say whether a confirmed draft write reaches workers at once (worker-read cutover OFF) or only after a separate publish (cutover ALL), or depends on the reading worker (MIXED); releasesEnabledForActor says whether this actor may prepare/preview/publish releases. The contentSchemas block reports page content-schema versioning: supportedVersions, defaultVersion, allowedNodeTypesByVersion, stableIdNodeTypesByVersion, YouTube embed limits, and the two-step schema-upgrade workflow. Requires instructions:read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionCapabilitiesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Inspect canonical job instructions",
        "description": "Returns the exact page tree displayed by the actual job Instructions tab, including its employer URL and folder-lock metadata. Requires instructions:read and employer access to the job.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionsInspectResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/preview": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Preview canonical job instruction content",
        "description": "Validates and renders TipTap JSON without writing, with the same validation as create and replace preflight (stable node ids, callout variants, image hosts, rendering). Returns findings, canApply (false when any finding is an ERROR), the contentSchemaVersion used, writesApplied=false and the exact employer job Instructions URL. Requires instructions:write and employer access.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/preflight": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Preflight an exact job instruction mutation",
        "description": "Validates target existence, permissions, current checksum, complete resulting TipTap semantics, renderability, media URLs, tree depth, and create idempotency without writing. A passing response includes a short-lived signed token bound to the exact operation and current canonical state; every live mutation requires that token.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionPreflightRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/verify": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Verify a canonical job instruction tree",
        "description": "Reads and semantically validates every canonical page, TipTap document, stable node ID, image URL, rendered output, and tree-depth invariant. Returns structured findings and a tree checksum. Requires instructions:read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/visual-review": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Plan authenticated visual verification of canonical job instructions",
        "description": "Returns the exact employer Instructions URL, ordered sidebar/page assertions, content checksums, image URLs, and desktop/laptop viewports. It explicitly identifies that worker-reader proof requires a real authenticated test contract and is not simulated by an employer token.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/tree/preflight": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Preflight an atomic canonical job instruction tree",
        "description": "Validates the complete desired page tree, content, checksums, ordering, one-subpage limit, archive set, schema-upgrade freeze, permissions, and idempotency without writing (the response always reports writesApplied:false). Returns normalized pages, the exact reviewed archive set, a plan digest, and a short-lived signed token.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionTreePreflightRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/tree/apply": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Atomically apply a canonical job instruction tree",
        "description": "Stages deterministic TipTap documents, fences the exact active database snapshot, and swaps the entire canonical job tree in one transaction. Whether workers see the write at once is stated on the response itself (visibility: workerVisibility IMMEDIATE / ON_PUBLISH / MIXED, the post-write draftRevision, the activeReleaseId workers on the cutover read, deliveredToWorkers) and per read by GET /instructions/capabilities (mutations.workerVisibility): IMMEDIATE means they read live drafts; ON_PUBLISH means they stay on the active release until a separate publish; MIXED means it depends on the reading worker. The operation is idempotently recoverable after interruption, and the response always reports writesApplied:true (including converged/replayed responses) — the preflight response reports writesApplied:false. Idempotency-Key must equal body.idempotencyKey.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable retry key required for canonical page creation and atomic tree apply."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionTreeApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/assets/images/plan": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Plan a canonical image URL without uploading",
        "description": "Validates image metadata and returns the private app URL (/api/instructions/assets/{id}) that the upload with the same Idempotency-Key returns, without storing bytes. The id is derived from the job, the caller and the idempotency key. Use it to make DOCX conversion and later upload byte-for-byte deterministic.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionImagePlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/assets/images": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "Idempotency-Key",
          "in": "header",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "description": "Stable retry key required for canonical page creation and atomic tree apply."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Upload a canonical job instruction image",
        "description": "Uploads an image for use in a TipTap image node. This does not change any page. Supports JPEG, PNG, WebP, GIF, and AVIF up to 4 MB; requires instructions:write and employer access. The image is stored privately and the response url is the app path /api/instructions/assets/{id}. That path serves nothing until a page write in this job places the url in a page; after that, only the owning organization and labelers with access to that page can load it, through a short-lived signed redirect.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Uploaded instruction image",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid image or request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/videos/prepare": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Prepare a native Cloudflare Stream instruction video upload",
        "description": "Rollout-gated and fail-closed (no legacy fallback on this surface). Proves the pageId belongs to this job’s writable Instructions set, reserves quota-sized provider storage from the REQUIRED durationSeconds, and returns a ONE-TIME direct TUS upload URL exactly once. Bytes go client→Cloudflare directly (pinned tus-js-client 4.3.1); they never pass through OpenTrain JSON. The upload URL is bearer-like and never persisted or replayed: a duplicate Idempotency-Key converges on the non-secret receipt (assetId/status) with recovery guidance to cancel and re-prepare under a NEW key. Idempotency-Key must equal body.idempotencyKey. The persisted document node stays the v1-compatible image marker with the stable /api/instructions/videos/{assetId} src.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable retry key required for canonical page creation and atomic tree apply."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionVideoPrepareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replayed instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionVideoPrepareResponse"
                }
              }
            }
          },
          "201": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionVideoPrepareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/videos/{assetId}": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "assetId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Native instruction video asset ID (UUID) returned by videos/prepare."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Read native instruction video status",
        "description": "Canonical REST readback only: reports PENDING/PROCESSING/READY/ERRORED with distinct storageReady (bytes accepted) vs playbackReady (READY) flags. browserVerified is always false here — use the visual-review plan plus the CLI visual check for real browser/collaboration rendering proof. Reconciles provider state on read with a bounded throttle.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionVideoStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/videos/{assetId}/cancel": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "assetId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Native instruction video asset ID (UUID) returned by videos/prepare."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Cancel a native instruction video upload",
        "description": "Uploader-bound and convergent (operation id job_instructions.videos.cancel). Releases the provider storage reservation: exact status \"canceled\" confirms the release; \"canceling\" means the release is still pending (retry cancel); \"ready\" means the asset became immutable first. READY assets can never be canceled or deleted. A successful cancel removes the asset, and the server keeps an uploader-bound tombstone (keyed by the asset id; no client key) so the uploader’s repeat returns \"canceled\". An unknown id, or another principal’s video, is 404.",
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionVideoCancelResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/assets/{kind}/prepare": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "in": "path",
          "name": "kind",
          "required": true,
          "schema": {
            "type": "string",
            "enum": [
              "audio",
              "file"
            ]
          },
          "description": "audio = an instructionAudio node; file = an instructionAttachment node (PDF/DOCX/XLSX/CSV/TXT)."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Prepare a private audio or file attachment upload",
        "description": "The editor’s own private-asset pipeline for job-scope agents (operation id job_instructions.assets.prepare). Proves the pageId belongs to this job’s writable Instructions set, validates the declared content type and size for the kind, persists a PENDING asset and returns a ONE-TIME signed PUT URL exactly once: PUT the bytes there with exactly upload.contentType, then POST …/assets/{assetId}/finalize (server-side byte sniff + size bound) and insert the returned node on a schema-v2 page. Bytes never pass through OpenTrain JSON. The URL is never persisted or replayed: a duplicate Idempotency-Key converges on the receipt with recovery guidance to cancel and re-prepare under a NEW key. Idempotency-Key must equal body.idempotencyKey.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable retry key required for canonical page creation and atomic tree apply."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionPrivateAssetPrepareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replayed instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPrivateAssetPrepareResponse"
                }
              }
            }
          },
          "201": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPrivateAssetPrepareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/assets/{assetId}": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "assetId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Native instruction video asset ID (UUID) returned by videos/prepare."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Read a private audio / file attachment asset’s status",
        "description": "Canonical REST readback of the asset row bound to this job’s Instructions set (operation id job_instructions.assets.get): PENDING / READY / ERRORED, storageReady, the verified size once READY, the delivery URL and the exact node to insert. Video assets live under /videos/{assetId}; they are not found here.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPrivateAssetStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/assets/{assetId}/finalize": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "assetId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Native instruction video asset ID (UUID) returned by videos/prepare."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Finalize a private audio / file attachment upload",
        "description": "Uploader-bound and convergent (operation id job_instructions.assets.finalize): verifies the stored object (byte sniff against the declared type, size bound), marks the asset READY and returns the delivery URL and the node to insert. An already-READY asset returns the same without re-verifying; an expired PENDING upload fails 400 — prepare again. A rejection for size, type or signature removes the asset, and the server keeps an uploader-bound tombstone (keyed by the asset id; no client key) so the uploader’s repeat returns the SAME rejection; a repeat after the uploader’s own cancel is 400 (canceled by you — prepare a new upload). An unknown id, or another principal’s asset, is 404.",
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPrivateAssetFinalizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/assets/{assetId}/cancel": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "assetId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Native instruction video asset ID (UUID) returned by videos/prepare."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Cancel a private audio / file attachment upload",
        "description": "Uploader-bound and convergent (operation id job_instructions.assets.cancel): releases a PENDING upload; \"canceled\" confirms it, \"ready\" means the asset was finalized first and stays, \"canceling\" means the release is still pending (repeat). READY assets can never be canceled or deleted. A successful cancel removes the asset, and the server keeps an uploader-bound tombstone (keyed by the asset id; no client key) so the uploader’s repeat — and a cancel after the uploader’s own rejected finalize — returns \"canceled\". An unknown id, or another principal’s asset, is 404.",
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPrivateAssetCancelResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Create a canonical job instruction page",
        "description": "Creates a rich TipTap page directly in the actual job Instructions workspace. The canonical write requires confirmLive=true and the signed token from the exact operation preflight. Whether workers see the write at once is stated on the response itself (visibility: workerVisibility IMMEDIATE / ON_PUBLISH / MIXED, the post-write draftRevision, the activeReleaseId workers on the cutover read, deliveredToWorkers) and per read by GET /instructions/capabilities (mutations.workerVisibility): IMMEDIATE means they read live drafts; ON_PUBLISH means they stay on the active release until a separate publish; MIXED means it depends on the reading worker. Requires instructions:write, employer access, and Idempotency-Key.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable retry key required for canonical page creation and atomic tree apply."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionPageCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages/{pageId}": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "pageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Canonical job instruction page ID."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Read a canonical job instruction page",
        "description": "Returns the rich TipTap JSON body and checksum from the same document used by the employer job Instructions tab (the DRAFT, which workers may not see yet). `released=true` (OPE-41073) returns the page exactly as workers read it instead — the job’s released effective view, `source: released`, release-pinned page identity, GOOGLE_DOC content live — whose checksum equals the one a released quiz grounding snapshot pins; write grounded quiz questions from that text. A job with nothing released is 409 `details.reason: INSTRUCTIONS_NOT_RELEASED`; a page that is not in the release (draft only) is 404 `details.reason: PAGE_NOT_RELEASED`. Resolving the released view may record the same idempotent effective-view row a worker read records. Requires instructions:read.",
        "parameters": [
          {
            "name": "released",
            "in": "query",
            "required": false,
            "description": "true = the page as workers see it (released effective view). Default false: the employer draft.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "default": "false"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/JobInstructionPageResponse"
                    },
                    {
                      "$ref": "#/components/schemas/JobInstructionReleasedPageResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "released=true on a job with no released Instructions (details.reason INSTRUCTIONS_NOT_RELEASED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "instructions"
        ],
        "summary": "Replace a canonical job instruction page",
        "description": "Explicit full-document replacement guarded by a fresh checksum, confirmReplace=true, confirmLive=true, and the signed token from the exact operation preflight. Requires instructions:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionPageReplaceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "instructions"
        ],
        "summary": "Patch or reorganize a canonical job instruction page",
        "description": "Accepts either checksum-guarded stable-node operations or page title/tree metadata. Canonical writes require confirmLive=true plus the signed token from the exact operation preflight. Whether workers see the write at once is stated on the response itself (visibility: workerVisibility IMMEDIATE / ON_PUBLISH / MIXED, the post-write draftRevision, the activeReleaseId workers on the cutover read, deliveredToWorkers) and per read by GET /instructions/capabilities (mutations.workerVisibility): IMMEDIATE means they read live drafts; ON_PUBLISH means they stay on the active release until a separate publish; MIXED means it depends on the reading worker. Requires instructions:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JobInstructionPagePatchRequest"
                  },
                  {
                    "$ref": "#/components/schemas/JobInstructionPageMetadataRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "instructions"
        ],
        "summary": "Archive a canonical job instruction page",
        "description": "Archives the page from the actual job Instructions tab. Requires confirmArchive=true, confirmLive=true, and the signed token from the exact operation preflight. Requires instructions:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionPageArchiveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages/{pageId}/link": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "pageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Canonical job instruction page ID."
        },
        {
          "name": "anchor",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": "Optional stable TipTap attrs.id. The server validates it against the canonical page before returning anchorUrl."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Resolve a canonical job instruction page link",
        "description": "Returns the actor-aware exact-page URL. When anchor is supplied, validates that stable node ID against the canonical page and returns an encoded anchorUrl. Requires instructions:read and employer access to the job.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPageLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages/{pageId}/history": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "pageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Canonical job instruction page ID."
        },
        {
          "name": "limit",
          "in": "query",
          "required": false,
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "description": "Page size (default 50)."
        },
        {
          "name": "cursor",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "description": "nextCursor from a previous page. Page-bound and versioned: foreign or malformed cursors fail with HTTP 400 code INVALID_CURSOR rather than restarting from page one."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "List draft checkpoints for a page",
        "description": "Newest-first immutable draft checkpoints (OpenTrain-owned; never TipTap in-room history) with provenance, digests, and stable keyset pagination. Content-free summaries — read a checkpoint for its body. Requires instructions:read and employer access to the job.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionHistoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Capture a manual draft checkpoint",
        "description": "Pins the provider-confirmed live document as a MANUAL checkpoint. Content-digest dedup makes this convergent without any key; created=false reports an unchanged live document truthfully. An OPTIONAL Idempotency-Key header enables receipt tracking (body.idempotencyKey, when set, must match it) and retries replay. Requires instructions:write.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Optional receipt-tracking retry key. When provided (and matching body.idempotencyKey if that is set), retries replay the durable receipt."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionManualCheckpointRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionManualCheckpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages/{pageId}/history/{checkpointId}": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "pageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Canonical job instruction page ID."
        },
        {
          "name": "checkpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Draft-history checkpoint ID from the history list."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Read one draft checkpoint",
        "description": "Returns the immutable checkpoint body (canonical TipTap JSON plus plain text) with its provenance and content digest. Requires instructions:read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionCheckpointContentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages/{pageId}/history/{checkpointId}/compare": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "pageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Canonical job instruction page ID."
        },
        {
          "name": "checkpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Draft-history checkpoint ID from the history list."
        },
        {
          "name": "to",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Target side: another checkpointId, or 'current' (default) for the live document. The current side includes the live checksum for conflict-aware follow-up writes."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Compare a draft checkpoint",
        "description": "Pure server-side stable-node diff between the checkpoint and either another checkpoint or the current live document. Read-only — no historical collaboration room is ever mounted. Requires instructions:read.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionCheckpointCompareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages/{pageId}/history/{checkpointId}/restore": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "pageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Canonical job instruction page ID."
        },
        {
          "name": "checkpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Draft-history checkpoint ID from the history list."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Restore a draft checkpoint",
        "description": "Explicit safe restore: verifies expectedChecksum against the live document, durably pins the pre-restore content as a RESTORE_BASELINE undo checkpoint (aborting if that pin fails), then copies the checkpoint content into a FRESH collaboration room behind the checksum/CAS pointer swap — an active Yjs room is never overwritten and a concurrent edit yields 409 CHECKSUM_MISMATCH. Requires confirmRestore=true, confirmLive=true, and an Idempotency-Key header matching body.idempotencyKey; retries replay the durable receipt instead of staging another room. Requires instructions:write.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable retry key required for canonical page creation and atomic tree apply."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionRestoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionRestoreResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/pages/{pageId}/schema-upgrade": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "pageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Canonical job instruction page ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Upgrade a page’s instruction content schema",
        "description": "Lazily upgrades one canonical page from content schema v1 to v2 (details/callout/youtube/audio/attachment blocks). Two-step quiesce workflow: action \"request\" opens a PENDING upgrade and freezes new write-token issuance; once the returned quiesceReadyAt passes, action \"complete\" performs the cutover, and \"status\" reports the current state without changing anything. Every action is convergent and idempotent — no Idempotency-Key is used, and an already-v2 page reports COMPLETED with alreadyUpgraded=true. The response carries no worker-visibility stamp (the cutover is content-preserving); poll GET …/revision after a completing call. Requires instructions:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionPageSchemaUpgradeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schema upgrade state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionPageSchemaUpgradeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Upgrade conflict. Reason SCHEMA_UPGRADE_IN_PROGRESS: a PENDING upgrade already exists for this page (a concurrent request won). Reason UPGRADE_IN_PROGRESS: writes are frozen while the upgrade is pending. Both carry the PENDING quiesceReadyAt/retryUntil retry timestamps — retry \"complete\" after quiesceReadyAt and before retryUntil, then re-request if expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/search": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "q",
          "in": "query",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": "Search text, 1–200 code points; NFC-normalized and trimmed by the server."
        },
        {
          "name": "limit",
          "in": "query",
          "required": false,
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "description": "Page groups per response (default 10)."
        },
        {
          "name": "cursor",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "description": "nextCursor from a previous response for the same job, query and unchanged ranked window. Foreign or malformed cursors fail with HTTP 400 code INVALID_CURSOR."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Search a job’s effective draft Instructions",
        "description": "The employer editor’s ranked search (full-text with a typo-tolerant fallback) over the job’s effective draft scopes — its own instruction set plus the folder set it inherits, exactly what this token reads through inspect and page get; never a worker’s released view. Returns page groups with up to five block hits each: stable block ids, anchor ids for deep links, the nearest heading, and inert plain-text snippets with code-point highlight ranges. Hits are ranked inside a bounded window (windowRows); truncated=true means the window filled — narrow the query. Pagination is over the ranked page groups with an opaque, query-bound cursor. Requires instructions:read and employer access to the job. Operation id job_instructions.search.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionSearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/revision": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "If-None-Match",
          "in": "header",
          "required": false,
          "schema": {
            "type": "string"
          },
          "description": "The ETag (revisionToken) of a previous response. While it still matches, the server answers 304 Not Modified with no body."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Read a job’s Instructions revision token",
        "description": "The durable change signal of the job’s Instructions, for cheap polling: the job set’s revision counter and the inherited folder set’s (each bumped on every committed structure or content change; folder membership changes bump the job counter), folded into one comparable, job-bound revisionToken that is also the strong ETag. Compare it to your last value, or send it as If-None-Match to get 304 (no body) until something changed — the server compares the token before loading anything else, so a poll loop costs one targeted employer-access check plus one coalesced counter read per tick. It says THAT something changed, never what — read inspect, page get, history or releases for the content. There is no durable event log or webhook: in-app revision events are ephemeral invalidation hints. Rate-limited per actor and per job on the poll’s own budget (429 with retryAfterSeconds). Requires instructions:read and employer access to the job (an active worker contract alone never grants it; a job the token cannot poll is 403 whether or not it exists). Operation id job_instructions.revision.get.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionRevisionResponse"
                }
              }
            },
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "The strong ETag: the quoted revisionToken."
              }
            }
          },
          "304": {
            "description": "Not Modified: the If-None-Match token is still current. No body; the ETag header repeats the current token.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "The strong ETag: the quoted revisionToken."
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Too many revision polls for this actor or job; retry after retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/compliance": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "name": "limit",
          "in": "query",
          "required": false,
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "description": "Contracts per page (default 50)."
        },
        {
          "name": "cursor",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": "nextCursor from a previous response for the SAME job. The cursor is opaque and bound to the job: a cursor from another job, or a malformed one, fails with HTTP 400 code INVALID_CURSOR rather than shifting the page."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "List a job’s Read Required compliance",
        "description": "The employer compliance matrix the dashboard shows: per participating contract, the worker’s Read Required state against the job’s published releases (NO_REVIEW_REQUIRED / SYNCING / ACTION_REQUIRED / MARKED_READ / UNDERSTOOD), the outstanding count and the last read / understood timestamps. Workers are referenced by id with a display name masked from the profile’s structured first/last name (first name plus last initial; a lone last name masks to its initial — never a full last name). Employer-only — worker acknowledgments never cross the public API — and gated by the Read Required rollout for the actor: an actor outside it receives 404 like the release routes. Keyset pagination over contract id with an opaque job-bound cursor (hasMore/nextCursor): a contract that leaves the participating set between pages is skipped, never a reason to drop its successor. Rate-limited per actor and per job, separately from the editor’s budget (429 with retryAfterSeconds). Requires instructions:read and employer access to the job. Operation id job_instructions.compliance.list.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionComplianceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, or a foreign/malformed cursor (code INVALID_CURSOR)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Too many compliance reads for this actor or job; retry after retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/compliance/remind": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Remind workers who have not acknowledged a Read Required release",
        "description": "Sends the existing in-app Read Required reminder (it names the job, says its Instructions need reading and links to the worker’s Instructions tab; no employer free text; the worker’s notification settings apply) to the workers who have not acknowledged one READ_REQUIRED release of the job — the job’s own release or one of the folder it inherits. Each worker gets at most one reminder per release: the claim is a unique database key on job, release and worker, so a repeat (any caller, any idempotency key) answers ALREADY_REMINDED for that worker and sends nothing, while a newer release allows a new reminder. Every handled worker gets a row with its outcome, and only REMINDED rows sent a reminder: acknowledged (ALREADY_ACKNOWLEDGED), not-required (NOT_REQUIRED), departed (NOT_ON_JOB) and banned, closed or deletion-pending (ACCOUNT_INACTIVE) workers are returned as rows and get nothing; a worker who turned off in-app Read Required reminders gets nothing and no reminder is recorded (NOTIFICATIONS_OFF); a worker whose notification could not be written gets FAILED and no reminder is recorded (retry with a NEW idempotency key). Without workerUserIds it walks every worker who has a requirement for the release, 100 per call, with an opaque job + release bound cursor. A release that is still being delivered to workers answers 409 RELEASE_SYNCING (retryable); a release whose delivery to workers failed answers 409 INSTRUCTIONS_RELEASE_DELIVERY_FAILED (permanent: a retry cannot succeed; a newer release can be reminded); a release that is not READ_REQUIRED answers 409 RELEASE_NOT_READ_REQUIRED; a release of another job is 404. Same employer boundary as the compliance read and the same Read Required rollout gate: an actor outside it receives 404. Requires instructions:write, a verified account, employer access to the job and an Idempotency-Key header matching body.idempotencyKey. Operation id job_instructions.compliance.remind.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable retry key required for canonical page creation and atomic tree apply."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobInstructionReminderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobInstructionReminderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, missing or mismatched Idempotency-Key, or a foreign/malformed cursor (code INVALID_CURSOR)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or release not found, or the Read Required rollout is off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Release not READ_REQUIRED, still being delivered (RELEASE_SYNCING, retryable), delivery failed (code INSTRUCTIONS_RELEASE_DELIVERY_FAILED, permanent), idempotency key reused, or the same key still in progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Too many reminder requests for this actor or job; retry after retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/releases": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "List immutable job Instructions releases",
        "description": "Lists published worker-facing releases for the canonical job Instructions set and reports whether the employer draft has unpublished changes. Requires instructions:read, employer access to the job, and the Instructions releases capability.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/releases/prepare": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Prepare an immutable job Instructions release candidate",
        "description": "Captures an expiring candidate from the current canonical employer draft. The candidate expires after 30 minutes and changes nothing workers read until it is separately previewed and published. Requires instructions:write, employer access to the job, and the Instructions releases capability.",
        "responses": {
          "201": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/releases/candidates/{candidateId}/preview": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        },
        {
          "in": "path",
          "name": "candidateId",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Prepared instruction release candidate ID."
        }
      ],
      "get": {
        "tags": [
          "instructions"
        ],
        "summary": "Preview an immutable job Instructions release candidate",
        "description": "Returns the page delta, semantic impact classification, recommended delivery policy with reason codes, estimated affected jobs and active contracts, and no-op status. This read applies no writes.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/jobs/{jobId}/releases/publish": {
      "parameters": [
        {
          "name": "jobId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Employer job ID."
        }
      ],
      "post": {
        "tags": [
          "instructions"
        ],
        "summary": "Publish an immutable job Instructions release",
        "description": "Publishes one prepared candidate as the worker-facing effective release. operationKey, confirm=true, and an explicit deliveryPolicy are required; there is no default. The release records the system recommendation and any employer override.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "candidateId",
                  "operationKey",
                  "confirm",
                  "deliveryPolicy"
                ],
                "properties": {
                  "candidateId": {
                    "type": "string"
                  },
                  "operationKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "confirm": {
                    "type": "boolean",
                    "const": true
                  },
                  "deliveryPolicy": {
                    "type": "string",
                    "enum": [
                      "SILENT",
                      "NOTIFY",
                      "READ_REQUIRED"
                    ]
                  },
                  "titleText": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "notesText": {
                    "type": "string",
                    "maxLength": 4000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Instruction response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or canonical document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing instruction scope or employer job permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or instruction page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, checksum, tree, or node conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/authoring/plan": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "planLearningAuthoring",
        "summary": "Plan learning authoring without writing",
        "description": "Requires lms:read or project_todos:read with the corresponding surface enabled. Select delivery path, purpose and applicable assessment policies. Never guesses missing choices. Show the returned summary and obtain employer confirmation before course/form creation with confirmedPlan. No content, receipts or assignments are created. Legacy content and dashboard editing remain compatible.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deliveryPath": {
                    "type": "string",
                    "enum": [
                      "STANDALONE_FORM",
                      "COURSE",
                      "INDIVIDUAL_RETRAINING"
                    ]
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "ONBOARDING",
                      "PRODUCTION_ENABLEMENT",
                      "REFRESHER",
                      "CORRECTIVE_RETRAINING",
                      "QUALIFICATION"
                    ]
                  },
                  "skillGap": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "assessment": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "model": {
                            "type": "string",
                            "const": "CONTENT_ONLY"
                          }
                        },
                        "required": [
                          "model"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "model": {
                            "type": "string",
                            "const": "FORMATIVE_PRACTICE"
                          },
                          "explanationTiming": {
                            "type": "string",
                            "const": "AFTER_SUBMISSION"
                          }
                        },
                        "required": [
                          "model"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "passThresholdPercent": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                          },
                          "attemptLimit": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10
                          },
                          "cooldownStepsSeconds": {
                            "minItems": 1,
                            "maxItems": 10,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 3600
                            }
                          },
                          "restartScope": {
                            "type": "string",
                            "enum": [
                              "WHOLE_MODULE",
                              "MISSED_QUESTIONS"
                            ]
                          },
                          "resultTiming": {
                            "type": "string",
                            "const": "IMMEDIATE"
                          },
                          "model": {
                            "type": "string",
                            "const": "AUTO_MASTERY"
                          }
                        },
                        "required": [
                          "model"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "autoWeightPercent": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 99
                          },
                          "rubric": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4000
                          },
                          "resultRelease": {
                            "type": "string",
                            "enum": [
                              "IMMEDIATE",
                              "MANUAL"
                            ]
                          },
                          "returnPolicy": {
                            "type": "string",
                            "enum": [
                              "REVISE_AND_RESUBMIT",
                              "NO_RETURN"
                            ]
                          },
                          "completionPolicy": {
                            "type": "string",
                            "enum": [
                              "SYSTEM",
                              "EMPLOYER_REVIEW"
                            ]
                          },
                          "model": {
                            "type": "string",
                            "const": "MIXED_QUALIFICATION"
                          }
                        },
                        "required": [
                          "model"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "autoWeightPercent": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 99
                          },
                          "rubric": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4000
                          },
                          "resultRelease": {
                            "type": "string",
                            "enum": [
                              "IMMEDIATE",
                              "MANUAL"
                            ]
                          },
                          "returnPolicy": {
                            "type": "string",
                            "enum": [
                              "REVISE_AND_RESUBMIT",
                              "NO_RETURN"
                            ]
                          },
                          "completionPolicy": {
                            "type": "string",
                            "enum": [
                              "SYSTEM",
                              "EMPLOYER_REVIEW"
                            ]
                          },
                          "model": {
                            "type": "string",
                            "const": "MANUAL_APPLIED"
                          }
                        },
                        "required": [
                          "model"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Learning authoring plan",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "NEEDS_INPUT",
                        "NEEDS_CONFIRMATION"
                      ]
                    },
                    "decision": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "schemaVersion": {
                              "type": "number",
                              "const": 1
                            },
                            "deliveryPath": {
                              "type": "string",
                              "enum": [
                                "STANDALONE_FORM",
                                "COURSE",
                                "INDIVIDUAL_RETRAINING"
                              ]
                            },
                            "purpose": {
                              "type": "string",
                              "enum": [
                                "ONBOARDING",
                                "PRODUCTION_ENABLEMENT",
                                "REFRESHER",
                                "CORRECTIVE_RETRAINING",
                                "QUALIFICATION"
                              ]
                            },
                            "assessment": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "type": "string",
                                      "const": "CONTENT_ONLY"
                                    }
                                  },
                                  "required": [
                                    "model"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "type": "string",
                                      "const": "FORMATIVE_PRACTICE"
                                    },
                                    "explanationTiming": {
                                      "type": "string",
                                      "const": "AFTER_SUBMISSION"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "explanationTiming"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "passThresholdPercent": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100
                                    },
                                    "attemptLimit": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 10
                                    },
                                    "cooldownStepsSeconds": {
                                      "minItems": 1,
                                      "maxItems": 10,
                                      "type": "array",
                                      "items": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 3600
                                      }
                                    },
                                    "restartScope": {
                                      "type": "string",
                                      "enum": [
                                        "WHOLE_MODULE",
                                        "MISSED_QUESTIONS"
                                      ]
                                    },
                                    "resultTiming": {
                                      "type": "string",
                                      "const": "IMMEDIATE"
                                    },
                                    "model": {
                                      "type": "string",
                                      "const": "AUTO_MASTERY"
                                    }
                                  },
                                  "required": [
                                    "passThresholdPercent",
                                    "attemptLimit",
                                    "cooldownStepsSeconds",
                                    "restartScope",
                                    "resultTiming",
                                    "model"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "autoWeightPercent": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 99
                                    },
                                    "rubric": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 4000
                                    },
                                    "resultRelease": {
                                      "type": "string",
                                      "enum": [
                                        "IMMEDIATE",
                                        "MANUAL"
                                      ]
                                    },
                                    "returnPolicy": {
                                      "type": "string",
                                      "enum": [
                                        "REVISE_AND_RESUBMIT",
                                        "NO_RETURN"
                                      ]
                                    },
                                    "completionPolicy": {
                                      "type": "string",
                                      "enum": [
                                        "SYSTEM",
                                        "EMPLOYER_REVIEW"
                                      ]
                                    },
                                    "model": {
                                      "type": "string",
                                      "const": "MIXED_QUALIFICATION"
                                    }
                                  },
                                  "required": [
                                    "autoWeightPercent",
                                    "rubric",
                                    "resultRelease",
                                    "returnPolicy",
                                    "completionPolicy",
                                    "model"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "autoWeightPercent": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 99
                                    },
                                    "rubric": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 4000
                                    },
                                    "resultRelease": {
                                      "type": "string",
                                      "enum": [
                                        "IMMEDIATE",
                                        "MANUAL"
                                      ]
                                    },
                                    "returnPolicy": {
                                      "type": "string",
                                      "enum": [
                                        "REVISE_AND_RESUBMIT",
                                        "NO_RETURN"
                                      ]
                                    },
                                    "completionPolicy": {
                                      "type": "string",
                                      "enum": [
                                        "SYSTEM",
                                        "EMPLOYER_REVIEW"
                                      ]
                                    },
                                    "model": {
                                      "type": "string",
                                      "const": "MANUAL_APPLIED"
                                    }
                                  },
                                  "required": [
                                    "autoWeightPercent",
                                    "rubric",
                                    "resultRelease",
                                    "returnPolicy",
                                    "completionPolicy",
                                    "model"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "skillGap": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            }
                          },
                          "required": [
                            "schemaVersion",
                            "deliveryPath",
                            "purpose",
                            "assessment"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "planHash": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "summary": {
                      "type": "string"
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "field": {
                            "type": "string"
                          },
                          "question": {
                            "type": "string"
                          },
                          "choices": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "field",
                          "question",
                          "choices"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "guidance": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "nextOperation": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "lms.courses.manage",
                            "project_todos.quizzes.manage"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "status",
                    "decision",
                    "planHash",
                    "summary",
                    "questions",
                    "guidance",
                    "nextOperation"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "INVALID_LEARNING_PLAN: unsupported or inconsistent learning-design choices",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "LMS authorization denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/capabilities": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsCapabilities",
        "summary": "Canonical LMS schema, vocabulary, limits, and workflows",
        "description": "Requires `lms:read`. Reports the canonical course schema and the shared TipTap `lmsLesson` document profile (`opentrain-lms-tiptap/1`): registry version; per-block author/edit/render support; attribute contracts; and private-media semantics. Dashboard, Preview, worker player, REST, SDK, CLI, stdio MCP, and hosted MCP all preserve this canonical JSON—clients must not substitute HTML or an interface-specific document model. Also reports allowed lesson node/mark types, assessment question types and settings enums, formal assessment roles (`assessmentRoles`: MODULE_QUIZ or QUALIFICATION_TEST; absent on historical content reads as MODULE_QUIZ), assessment lesson completion modes (`completionModes`: ON_SUBMIT completes on submission without a pass verdict, ON_PASS gates on the released passing verdict, ON_REVIEW gates on the explicit employer decision; absent = legacy pass/review semantics), per-kind asset MIME/limits with BOTH the domain ceiling and automation transport cap (`automationUploadMaxBytes` / `effectiveMaxBytes`), idempotency contracts, operation groups, workflow flags, the safe asset-replacement sequence, and truthful `progression` / `knowledgeChecks` availability (both currently report `canonicalModelAvailable: false`).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "LMS capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/recover-create": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "recoverLmsCourseCreate",
        "summary": "Recover a course creation outcome by operation key",
        "description": "Requires `lms:read`. Post-timeout recovery: reports `NOT_STARTED` (safe to submit the same key), `IN_PROGRESS` (durable receipt still pending; retry the SAME key + payload to converge), `SUCCEEDED` (organization-scoped course returned), or `KEY_UNAVAILABLE` (this account already used the key in a different workspace context — use a fresh key; never returns another organization’s data).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "operationKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recovery status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "operationKey missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsCourses",
        "summary": "List organization LMS courses",
        "description": "Requires `lms:read`, a claimed token, the LMS rollout, and the default-off LMS agent surface. Returns active and archived organization-owned courses plus authorized canonical human-navigation links. Every course carries `attribution` (creator and last material updater; stable ids always, display fields only for current organization identities, explicit `notAvailableReason` for historical gaps).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Course library",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "courses"
                  ],
                  "properties": {
                    "courses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "required": [
                          "attribution"
                        ],
                        "properties": {
                          "links": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/LmsCanonicalLink"
                            }
                          },
                          "attribution": {
                            "$ref": "#/components/schemas/LmsCourseAttribution"
                          },
                          "authoringDecision": {
                            "type": "object",
                            "properties": {
                              "decision": {
                                "type": "object",
                                "properties": {
                                  "schemaVersion": {
                                    "type": "number",
                                    "const": 1
                                  },
                                  "deliveryPath": {
                                    "type": "string",
                                    "enum": [
                                      "STANDALONE_FORM",
                                      "COURSE",
                                      "INDIVIDUAL_RETRAINING"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "ONBOARDING",
                                      "PRODUCTION_ENABLEMENT",
                                      "REFRESHER",
                                      "CORRECTIVE_RETRAINING",
                                      "QUALIFICATION"
                                    ]
                                  },
                                  "assessment": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "model": {
                                            "type": "string",
                                            "const": "CONTENT_ONLY"
                                          }
                                        },
                                        "required": [
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "model": {
                                            "type": "string",
                                            "const": "FORMATIVE_PRACTICE"
                                          },
                                          "explanationTiming": {
                                            "type": "string",
                                            "const": "AFTER_SUBMISSION"
                                          }
                                        },
                                        "required": [
                                          "model",
                                          "explanationTiming"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "passThresholdPercent": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 100
                                          },
                                          "attemptLimit": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 10
                                          },
                                          "cooldownStepsSeconds": {
                                            "minItems": 1,
                                            "maxItems": 10,
                                            "type": "array",
                                            "items": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 3600
                                            }
                                          },
                                          "restartScope": {
                                            "type": "string",
                                            "enum": [
                                              "WHOLE_MODULE",
                                              "MISSED_QUESTIONS"
                                            ]
                                          },
                                          "resultTiming": {
                                            "type": "string",
                                            "const": "IMMEDIATE"
                                          },
                                          "model": {
                                            "type": "string",
                                            "const": "AUTO_MASTERY"
                                          }
                                        },
                                        "required": [
                                          "passThresholdPercent",
                                          "attemptLimit",
                                          "cooldownStepsSeconds",
                                          "restartScope",
                                          "resultTiming",
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "autoWeightPercent": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99
                                          },
                                          "rubric": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "resultRelease": {
                                            "type": "string",
                                            "enum": [
                                              "IMMEDIATE",
                                              "MANUAL"
                                            ]
                                          },
                                          "returnPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "REVISE_AND_RESUBMIT",
                                              "NO_RETURN"
                                            ]
                                          },
                                          "completionPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "SYSTEM",
                                              "EMPLOYER_REVIEW"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "const": "MIXED_QUALIFICATION"
                                          }
                                        },
                                        "required": [
                                          "autoWeightPercent",
                                          "rubric",
                                          "resultRelease",
                                          "returnPolicy",
                                          "completionPolicy",
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "autoWeightPercent": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99
                                          },
                                          "rubric": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "resultRelease": {
                                            "type": "string",
                                            "enum": [
                                              "IMMEDIATE",
                                              "MANUAL"
                                            ]
                                          },
                                          "returnPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "REVISE_AND_RESUBMIT",
                                              "NO_RETURN"
                                            ]
                                          },
                                          "completionPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "SYSTEM",
                                              "EMPLOYER_REVIEW"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "const": "MANUAL_APPLIED"
                                          }
                                        },
                                        "required": [
                                          "autoWeightPercent",
                                          "rubric",
                                          "resultRelease",
                                          "returnPolicy",
                                          "completionPolicy",
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  "skillGap": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "required": [
                                  "schemaVersion",
                                  "deliveryPath",
                                  "purpose",
                                  "assessment"
                                ],
                                "additionalProperties": false
                              },
                              "planHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "summary": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 8000
                              },
                              "confirmedByUserId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "decision",
                              "planHash",
                              "summary",
                              "confirmedByUserId"
                            ],
                            "additionalProperties": false
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, or organization denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "createLmsCourse",
        "summary": "Create an LMS course draft",
        "description": "Requires `lms:write`, a claimed token, the LMS rollout, the default-off LMS agent surface, and `Idempotency-Key` (durable-receipt contract). Optional originJobId records provenance only and never assigns anyone. The key binds the CANONICAL payload (defaults applied), so omitted vs explicit-default fields converge; after a response timeout, read `/lms/courses/recover-create?operationKey=` for NOT_STARTED / IN_PROGRESS / SUCCEEDED before retrying.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title"
                ],
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "confirmedPlan": {
                    "type": "object",
                    "properties": {
                      "decision": {
                        "type": "object",
                        "properties": {
                          "schemaVersion": {
                            "type": "number",
                            "const": 1
                          },
                          "deliveryPath": {
                            "type": "string",
                            "enum": [
                              "STANDALONE_FORM",
                              "COURSE",
                              "INDIVIDUAL_RETRAINING"
                            ]
                          },
                          "purpose": {
                            "type": "string",
                            "enum": [
                              "ONBOARDING",
                              "PRODUCTION_ENABLEMENT",
                              "REFRESHER",
                              "CORRECTIVE_RETRAINING",
                              "QUALIFICATION"
                            ]
                          },
                          "assessment": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "model": {
                                    "type": "string",
                                    "const": "CONTENT_ONLY"
                                  }
                                },
                                "required": [
                                  "model"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "model": {
                                    "type": "string",
                                    "const": "FORMATIVE_PRACTICE"
                                  },
                                  "explanationTiming": {
                                    "type": "string",
                                    "const": "AFTER_SUBMISSION"
                                  }
                                },
                                "required": [
                                  "model",
                                  "explanationTiming"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "passThresholdPercent": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "attemptLimit": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 10
                                  },
                                  "cooldownStepsSeconds": {
                                    "minItems": 1,
                                    "maxItems": 10,
                                    "type": "array",
                                    "items": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3600
                                    }
                                  },
                                  "restartScope": {
                                    "type": "string",
                                    "enum": [
                                      "WHOLE_MODULE",
                                      "MISSED_QUESTIONS"
                                    ]
                                  },
                                  "resultTiming": {
                                    "type": "string",
                                    "const": "IMMEDIATE"
                                  },
                                  "model": {
                                    "type": "string",
                                    "const": "AUTO_MASTERY"
                                  }
                                },
                                "required": [
                                  "passThresholdPercent",
                                  "attemptLimit",
                                  "cooldownStepsSeconds",
                                  "restartScope",
                                  "resultTiming",
                                  "model"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "autoWeightPercent": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "rubric": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 4000
                                  },
                                  "resultRelease": {
                                    "type": "string",
                                    "enum": [
                                      "IMMEDIATE",
                                      "MANUAL"
                                    ]
                                  },
                                  "returnPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "REVISE_AND_RESUBMIT",
                                      "NO_RETURN"
                                    ]
                                  },
                                  "completionPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "SYSTEM",
                                      "EMPLOYER_REVIEW"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "const": "MIXED_QUALIFICATION"
                                  }
                                },
                                "required": [
                                  "autoWeightPercent",
                                  "rubric",
                                  "resultRelease",
                                  "returnPolicy",
                                  "completionPolicy",
                                  "model"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "autoWeightPercent": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "rubric": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 4000
                                  },
                                  "resultRelease": {
                                    "type": "string",
                                    "enum": [
                                      "IMMEDIATE",
                                      "MANUAL"
                                    ]
                                  },
                                  "returnPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "REVISE_AND_RESUBMIT",
                                      "NO_RETURN"
                                    ]
                                  },
                                  "completionPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "SYSTEM",
                                      "EMPLOYER_REVIEW"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "const": "MANUAL_APPLIED"
                                  }
                                },
                                "required": [
                                  "autoWeightPercent",
                                  "rubric",
                                  "resultRelease",
                                  "returnPolicy",
                                  "completionPolicy",
                                  "model"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "skillGap": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "required": [
                          "schemaVersion",
                          "deliveryPath",
                          "purpose",
                          "assessment"
                        ],
                        "additionalProperties": false
                      },
                      "planHash": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "confirm": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "decision",
                      "planHash",
                      "confirm"
                    ],
                    "additionalProperties": false,
                    "description": "Required only when LMS_REQUIRE_CONFIRMED_LEARNING_PLAN=true. Default warn mode admits omission without storing a decision and returns learningPlan guidance. Supplied plans are always validated."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "draftTree": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "originJobId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created course",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "course": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "learningPlan": {
                      "type": "object",
                      "properties": {
                        "required": {
                          "type": "boolean",
                          "const": false
                        },
                        "missing": {
                          "type": "boolean",
                          "const": true
                        },
                        "next": {
                          "type": "string",
                          "const": "lms.authoring.plan"
                        }
                      },
                      "required": [
                        "required",
                        "missing",
                        "next"
                      ],
                      "additionalProperties": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or CONFLICT with details.reason LEARNING_PLAN_REQUIRED: missing plan when enforcement is enabled, or an invalid, changed, cross-organization or wrong-target supplied plan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsCourse",
        "summary": "Read an LMS course draft",
        "description": "Requires `lms:read`; tenant-scoped to the token owner organization. Includes authorized canonical human-navigation links for the course and its job contexts, plus `attribution` (creator and last material updater with explicit `notAvailableReason` for historical gaps).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Course",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "course": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "attribution"
                      ],
                      "properties": {
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LmsCanonicalLink"
                          }
                        },
                        "attribution": {
                          "$ref": "#/components/schemas/LmsCourseAttribution"
                        },
                        "authoringDecision": {
                          "type": "object",
                          "properties": {
                            "decision": {
                              "type": "object",
                              "properties": {
                                "schemaVersion": {
                                  "type": "number",
                                  "const": 1
                                },
                                "deliveryPath": {
                                  "type": "string",
                                  "enum": [
                                    "STANDALONE_FORM",
                                    "COURSE",
                                    "INDIVIDUAL_RETRAINING"
                                  ]
                                },
                                "purpose": {
                                  "type": "string",
                                  "enum": [
                                    "ONBOARDING",
                                    "PRODUCTION_ENABLEMENT",
                                    "REFRESHER",
                                    "CORRECTIVE_RETRAINING",
                                    "QUALIFICATION"
                                  ]
                                },
                                "assessment": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "model": {
                                          "type": "string",
                                          "const": "CONTENT_ONLY"
                                        }
                                      },
                                      "required": [
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "model": {
                                          "type": "string",
                                          "const": "FORMATIVE_PRACTICE"
                                        },
                                        "explanationTiming": {
                                          "type": "string",
                                          "const": "AFTER_SUBMISSION"
                                        }
                                      },
                                      "required": [
                                        "model",
                                        "explanationTiming"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "passThresholdPercent": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 100
                                        },
                                        "attemptLimit": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 10
                                        },
                                        "cooldownStepsSeconds": {
                                          "minItems": 1,
                                          "maxItems": 10,
                                          "type": "array",
                                          "items": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 3600
                                          }
                                        },
                                        "restartScope": {
                                          "type": "string",
                                          "enum": [
                                            "WHOLE_MODULE",
                                            "MISSED_QUESTIONS"
                                          ]
                                        },
                                        "resultTiming": {
                                          "type": "string",
                                          "const": "IMMEDIATE"
                                        },
                                        "model": {
                                          "type": "string",
                                          "const": "AUTO_MASTERY"
                                        }
                                      },
                                      "required": [
                                        "passThresholdPercent",
                                        "attemptLimit",
                                        "cooldownStepsSeconds",
                                        "restartScope",
                                        "resultTiming",
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "autoWeightPercent": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 99
                                        },
                                        "rubric": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "resultRelease": {
                                          "type": "string",
                                          "enum": [
                                            "IMMEDIATE",
                                            "MANUAL"
                                          ]
                                        },
                                        "returnPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "REVISE_AND_RESUBMIT",
                                            "NO_RETURN"
                                          ]
                                        },
                                        "completionPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "SYSTEM",
                                            "EMPLOYER_REVIEW"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "const": "MIXED_QUALIFICATION"
                                        }
                                      },
                                      "required": [
                                        "autoWeightPercent",
                                        "rubric",
                                        "resultRelease",
                                        "returnPolicy",
                                        "completionPolicy",
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "autoWeightPercent": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 99
                                        },
                                        "rubric": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "resultRelease": {
                                          "type": "string",
                                          "enum": [
                                            "IMMEDIATE",
                                            "MANUAL"
                                          ]
                                        },
                                        "returnPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "REVISE_AND_RESUBMIT",
                                            "NO_RETURN"
                                          ]
                                        },
                                        "completionPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "SYSTEM",
                                            "EMPLOYER_REVIEW"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "const": "MANUAL_APPLIED"
                                        }
                                      },
                                      "required": [
                                        "autoWeightPercent",
                                        "rubric",
                                        "resultRelease",
                                        "returnPolicy",
                                        "completionPolicy",
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "skillGap": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000
                                }
                              },
                              "required": [
                                "schemaVersion",
                                "deliveryPath",
                                "purpose",
                                "assessment"
                              ],
                              "additionalProperties": false
                            },
                            "planHash": {
                              "type": "string",
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "summary": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 8000
                            },
                            "confirmedByUserId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "decision",
                            "planHash",
                            "summary",
                            "confirmedByUserId"
                          ],
                          "additionalProperties": false
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Course not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "lms"
        ],
        "operationId": "updateLmsCourseDraft",
        "summary": "Revision-guarded LMS course draft update",
        "description": "Requires `lms:write` and `Idempotency-Key`. expectedRevision prevents overwriting a concurrent author; the full normalized draft tree is replaced atomically.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedRevision",
                  "title",
                  "draftTree"
                ],
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "draftTree": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated course",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "course": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/validate": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "validateLmsCourseDraft",
        "summary": "Validate and preview an LMS course draft",
        "description": "Requires `lms:write` and `Idempotency-Key`. This operation performs no writes; it returns normalized canonical draft content, a deterministic preview hash, exact assessment pins, asset findings, publish blockers, the effective persisted/request/default `authoringIntent`, and `validation.authoring` diagnostics with acknowledgement identities. The body is optional and strict: `{}` uses the draft declaration or legacy STANDARD/SYSTEM default; request `validationIntent` and/or `completionPolicy` are explicit validation overrides. Warnings never fail validation; contradictory mastery/employer-review intent fails closed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "validationIntent": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "INDIVIDUAL_MASTERY"
                    ]
                  },
                  "completionPolicy": {
                    "type": "string",
                    "enum": [
                      "SYSTEM",
                      "EMPLOYER_REVIEW"
                    ]
                  },
                  "acknowledgements": {
                    "type": "array",
                    "maxItems": 200,
                    "items": {
                      "$ref": "#/components/schemas/LmsAuthoringAcknowledgement"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview and validation findings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "required": [
                    "courseId",
                    "preview",
                    "validation"
                  ],
                  "properties": {
                    "courseId": {
                      "type": "string"
                    },
                    "preview": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "validation": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "valid",
                        "problems",
                        "assessments",
                        "assets",
                        "authoringIntent",
                        "authoring"
                      ],
                      "properties": {
                        "valid": {
                          "type": "boolean"
                        },
                        "problems": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "assessments": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "assets": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "authoringIntent": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "declared",
                            "effective",
                            "source"
                          ],
                          "properties": {
                            "declared": {
                              "oneOf": [
                                {
                                  "$ref": "#/components/schemas/LmsCourseAuthoringIntent"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "effective": {
                              "$ref": "#/components/schemas/LmsCourseAuthoringIntent"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "REQUEST",
                                "DRAFT",
                                "DEFAULT"
                              ]
                            }
                          }
                        },
                        "authoring": {
                          "$ref": "#/components/schemas/LmsAuthoringAnalysis"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid validation intent or acknowledgement shape",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Course not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/publish": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "publishLmsCourse",
        "summary": "Publish an immutable LMS course version",
        "description": "Requires `lms:write`, `Idempotency-Key`, expectedDraftRevision, and explicit `confirmPublish: true`. Publishing freezes exact Native Form versions, READY LMS assets, and the canonical draft authoringIntent. It does not update existing learner assignments. Optional validationIntent/completionPolicy may confirm the declared intent but cannot silently override a conflicting stored declaration. Authoring contradictions fail closed with `400 AUTHORING_CONTRADICTION`; unacknowledged warnings fail with `409 AUTHORING_ACK_REQUIRED`. Acknowledgements remain request-scoped; run validate first.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedDraftRevision",
                  "confirmPublish"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedDraftRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "confirmPublish": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "validationIntent": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "INDIVIDUAL_MASTERY"
                    ]
                  },
                  "completionPolicy": {
                    "type": "string",
                    "enum": [
                      "SYSTEM",
                      "EMPLOYER_REVIEW"
                    ]
                  },
                  "acknowledgements": {
                    "type": "array",
                    "maxItems": 200,
                    "items": {
                      "$ref": "#/components/schemas/LmsAuthoringAcknowledgement"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Published version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "version",
                    "existingAssignments",
                    "nextAction"
                  ],
                  "properties": {
                    "version": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "existingAssignments": {
                      "type": "object",
                      "required": [
                        "updated",
                        "reason"
                      ],
                      "properties": {
                        "updated": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "PUBLISHED_VERSIONS_ARE_IMMUTABLE"
                          ]
                        }
                      }
                    },
                    "nextAction": {
                      "type": "object",
                      "required": [
                        "requiredForExistingAssignments",
                        "operation",
                        "courseId",
                        "courseVersionId",
                        "expectedContentHash",
                        "applyOperation",
                        "statusOperation",
                        "receiptOperation"
                      ],
                      "properties": {
                        "requiredForExistingAssignments": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "operation": {
                          "type": "string",
                          "enum": [
                            "lms.courses.rollout_preview"
                          ]
                        },
                        "courseId": {
                          "type": "string"
                        },
                        "courseVersionId": {
                          "type": "string"
                        },
                        "expectedContentHash": {
                          "type": "string"
                        },
                        "applyOperation": {
                          "type": "string",
                          "enum": [
                            "lms.courses.rollout"
                          ]
                        },
                        "statusOperation": {
                          "type": "string",
                          "enum": [
                            "lms.courses.rollout_status"
                          ]
                        },
                        "receiptOperation": {
                          "type": "string",
                          "enum": [
                            "lms.courses.rollout_receipt"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Structural problem, or AUTHORING_CONTRADICTION (non-acknowledgeable authoring ERROR findings; details carry the closed finding records)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision, validation, or idempotency conflict, or AUTHORING_ACK_REQUIRED (details.acknowledgementIds lists the exact ids to echo back)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/archive": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "archiveLmsCourse",
        "summary": "Archive an LMS course",
        "description": "Requires `lms:write` and `Idempotency-Key`. Existing assignments retain history.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "responses": {
          "200": {
            "description": "Archived course",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/unarchive": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "unarchiveLmsCourse",
        "summary": "Restore an archived LMS course",
        "description": "Requires `lms:write` and `Idempotency-Key`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "responses": {
          "200": {
            "description": "Restored course",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/rollout": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "rolloutLmsCourseVersion",
        "summary": "Roll a published version out to active learners (apply-time reclassification)",
        "description": "DESTRUCTIVE APPLY. Requires `lms:write`, `Idempotency-Key`, explicit `confirmApply: true`, and an explicit audience (`jobId` and/or a non-empty `assignmentIds` selection — org-wide rollouts are not expressible). Body: `{toCourseVersionId, expectedToContentHash, jobId?, assignmentIds?, confirmApply, policy?}`. Every in-scope assignment is re-read, reclassified, and mutated atomically in its OWN short transaction — ordinary learner progress drift never rejects the batch, and one assignment’s contention or failure never rolls back the others (isolated truthful `FAILED` outcomes with reasons; reprocess under a fresh key). Eligible assignments migrate now with state carried; unsafe/mid-work assignments queue and auto-migrate at their next safe boundary; already-current and terminal rows skip idempotently; deterministic incompatibility blocks that assignment. Submitted attempts stay pinned to their original form/course rules and are never regraded; no assignment is cancelled, recreated, or reset. Returns the durable batch receipt (per-assignment outcomes + `counts {updatedNow, queued, alreadyCurrent, skippedTerminal, blocked, failed}`), replayed verbatim for the same key; a different request on the same key conflicts.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "toCourseVersionId",
                  "expectedToContentHash",
                  "confirmApply"
                ],
                "properties": {
                  "toCourseVersionId": {
                    "type": "string"
                  },
                  "expectedToContentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{64}$",
                    "description": "Exact published content hash of the target version."
                  },
                  "jobId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Audience: jobId and/or a non-empty assignmentIds is REQUIRED for apply."
                  },
                  "assignmentIds": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 500
                  },
                  "policy": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "assessmentReplaced",
                      "contentChanged",
                      "openWork",
                      "completedAssignments"
                    ],
                    "properties": {
                      "assessmentReplaced": {
                        "type": "string",
                        "enum": [
                          "RESET",
                          "GRANDFATHER"
                        ]
                      },
                      "contentChanged": {
                        "type": "string",
                        "enum": [
                          "CARRY",
                          "RESET"
                        ]
                      },
                      "openWork": {
                        "type": "string",
                        "enum": [
                          "DEFER"
                        ]
                      },
                      "completedAssignments": {
                        "type": "string",
                        "enum": [
                          "SKIP"
                        ]
                      }
                    }
                  },
                  "confirmApply": {
                    "type": "boolean",
                    "enum": [
                      true
                    ],
                    "description": "Explicit destructive-apply confirmation."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rollout batch receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "rollout"
                  ],
                  "properties": {
                    "rollout": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "replayed",
                        "preflightId",
                        "requestHash",
                        "toCourseVersionId",
                        "toContentHash",
                        "scope",
                        "counts",
                        "results",
                        "carriedCompletionModes"
                      ],
                      "properties": {
                        "replayed": {
                          "type": "boolean"
                        },
                        "preflightId": {
                          "type": "string"
                        },
                        "requestHash": {
                          "type": "string"
                        },
                        "toCourseVersionId": {
                          "type": "string"
                        },
                        "toContentHash": {
                          "type": "string"
                        },
                        "scope": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "jobId",
                            "assignmentIds"
                          ],
                          "properties": {
                            "jobId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "assignmentIds": {
                              "type": [
                                "array",
                                "null"
                              ],
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "counts": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "updatedNow",
                            "queued",
                            "alreadyCurrent",
                            "skippedTerminal",
                            "blocked",
                            "failed"
                          ],
                          "properties": {
                            "updatedNow": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "queued": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "alreadyCurrent": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "skippedTerminal": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "blocked": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "failed": {
                              "type": "integer",
                              "minimum": 0
                            }
                          }
                        },
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "assignmentId",
                              "bindingId",
                              "outcome",
                              "reason"
                            ],
                            "properties": {
                              "assignmentId": {
                                "type": "string"
                              },
                              "bindingId": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": "string",
                                "enum": [
                                  "APPLIED",
                                  "DEFERRED",
                                  "SKIPPED",
                                  "BLOCKED",
                                  "FAILED"
                                ]
                              },
                              "reason": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          }
                        },
                        "carriedCompletionModes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "lessonKey",
                              "completionMode",
                              "fromCourseVersionIds"
                            ],
                            "properties": {
                              "lessonKey": {
                                "type": "string"
                              },
                              "completionMode": {
                                "type": "string"
                              },
                              "fromCourseVersionIds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsCourseRolloutStatus",
        "summary": "Latest rollout receipt without an operation key (reload-safe status)",
        "description": "Requires `lms:read`. Returns the newest RELEASE_ROLLOUT_RECORDED receipt for this course (optionally narrowed by `toCourseVersionId` and/or `jobId` query params), including its operation key, per-assignment outcomes, counts, carried completion modes, and the live queued pending count. Lets the employer UI inspect a pending rollout after a reload without remembering an operation key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "toCourseVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest rollout status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "rollout",
                    "pendingQueued"
                  ],
                  "properties": {
                    "rollout": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "replayed",
                            "preflightId",
                            "requestHash",
                            "toCourseVersionId",
                            "toContentHash",
                            "scope",
                            "counts",
                            "results",
                            "carriedCompletionModes",
                            "recordedAt",
                            "operationKey"
                          ],
                          "properties": {
                            "replayed": {
                              "type": "boolean"
                            },
                            "preflightId": {
                              "type": "string"
                            },
                            "requestHash": {
                              "type": "string"
                            },
                            "toCourseVersionId": {
                              "type": "string"
                            },
                            "toContentHash": {
                              "type": "string"
                            },
                            "scope": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "jobId",
                                "assignmentIds"
                              ],
                              "properties": {
                                "jobId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "assignmentIds": {
                                  "type": [
                                    "array",
                                    "null"
                                  ],
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "counts": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "updatedNow",
                                "queued",
                                "alreadyCurrent",
                                "skippedTerminal",
                                "blocked",
                                "failed"
                              ],
                              "properties": {
                                "updatedNow": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "queued": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "alreadyCurrent": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "skippedTerminal": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "blocked": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "failed": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              }
                            },
                            "results": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "assignmentId",
                                  "bindingId",
                                  "outcome",
                                  "reason"
                                ],
                                "properties": {
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "bindingId": {
                                    "type": "string"
                                  },
                                  "outcome": {
                                    "type": "string",
                                    "enum": [
                                      "APPLIED",
                                      "DEFERRED",
                                      "SKIPPED",
                                      "BLOCKED",
                                      "FAILED"
                                    ]
                                  },
                                  "reason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            },
                            "carriedCompletionModes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "completionMode",
                                  "fromCourseVersionIds"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "completionMode": {
                                    "type": "string"
                                  },
                                  "fromCourseVersionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            },
                            "recordedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "operationKey": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "pendingQueued": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/rollout-preview": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "previewLmsCourseRollout",
        "summary": "Informational live rollout preview (never a fence)",
        "description": "Requires `lms:read`. Runs the EXACT apply-time classifier read-only over live state and returns would-be per-assignment outcomes + counts. Counts can change the moment learners act; nothing here fences or is required by the apply, which reclassifies live state itself. Zero writes; no idempotency key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "toCourseVersionId",
                  "expectedToContentHash"
                ],
                "properties": {
                  "toCourseVersionId": {
                    "type": "string"
                  },
                  "expectedToContentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{64}$",
                    "description": "Exact published content hash of the target version."
                  },
                  "jobId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Audience: jobId and/or a non-empty assignmentIds is REQUIRED for apply."
                  },
                  "assignmentIds": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 500
                  },
                  "policy": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "assessmentReplaced",
                      "contentChanged",
                      "openWork",
                      "completedAssignments"
                    ],
                    "properties": {
                      "assessmentReplaced": {
                        "type": "string",
                        "enum": [
                          "RESET",
                          "GRANDFATHER"
                        ]
                      },
                      "contentChanged": {
                        "type": "string",
                        "enum": [
                          "CARRY",
                          "RESET"
                        ]
                      },
                      "openWork": {
                        "type": "string",
                        "enum": [
                          "DEFER"
                        ]
                      },
                      "completedAssignments": {
                        "type": "string",
                        "enum": [
                          "SKIP"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Informational preview",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "preview"
                  ],
                  "properties": {
                    "preview": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "informational",
                        "toCourseVersionId",
                        "toContentHash",
                        "counts",
                        "results"
                      ],
                      "properties": {
                        "informational": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "toCourseVersionId": {
                          "type": "string"
                        },
                        "toContentHash": {
                          "type": "string"
                        },
                        "counts": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "updatedNow",
                            "queued",
                            "alreadyCurrent",
                            "skippedTerminal",
                            "blocked",
                            "failed"
                          ],
                          "properties": {
                            "updatedNow": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "queued": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "alreadyCurrent": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "skippedTerminal": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "blocked": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "failed": {
                              "type": "integer",
                              "minimum": 0
                            }
                          }
                        },
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "assignmentId",
                              "bindingId",
                              "outcome",
                              "reason"
                            ],
                            "properties": {
                              "assignmentId": {
                                "type": "string"
                              },
                              "bindingId": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": "string",
                                "enum": [
                                  "APPLIED",
                                  "DEFERRED",
                                  "SKIPPED",
                                  "BLOCKED",
                                  "FAILED"
                                ]
                              },
                              "reason": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/rollout/{operationKey}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsCourseRolloutReceipt",
        "summary": "Read a rollout batch receipt plus the live queued pending count",
        "description": "Requires `lms:read`. Returns the immutable batch receipt recorded for the operation key (`rollout: null` when none committed) and `pendingQueued` — the LIVE count of assignments still parked for the receipt’s target version, reaching zero as safe boundaries clear. Poll this instead of refreshing mutable state.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "operationKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rollout receipt + pending state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "rollout",
                    "pendingQueued"
                  ],
                  "properties": {
                    "rollout": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "replayed",
                            "preflightId",
                            "requestHash",
                            "toCourseVersionId",
                            "toContentHash",
                            "scope",
                            "counts",
                            "results",
                            "carriedCompletionModes",
                            "recordedAt"
                          ],
                          "properties": {
                            "replayed": {
                              "type": "boolean"
                            },
                            "preflightId": {
                              "type": "string"
                            },
                            "requestHash": {
                              "type": "string"
                            },
                            "toCourseVersionId": {
                              "type": "string"
                            },
                            "toContentHash": {
                              "type": "string"
                            },
                            "scope": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "jobId",
                                "assignmentIds"
                              ],
                              "properties": {
                                "jobId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "assignmentIds": {
                                  "type": [
                                    "array",
                                    "null"
                                  ],
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "counts": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "updatedNow",
                                "queued",
                                "alreadyCurrent",
                                "skippedTerminal",
                                "blocked",
                                "failed"
                              ],
                              "properties": {
                                "updatedNow": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "queued": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "alreadyCurrent": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "skippedTerminal": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "blocked": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "failed": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              }
                            },
                            "results": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "assignmentId",
                                  "bindingId",
                                  "outcome",
                                  "reason"
                                ],
                                "properties": {
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "bindingId": {
                                    "type": "string"
                                  },
                                  "outcome": {
                                    "type": "string",
                                    "enum": [
                                      "APPLIED",
                                      "DEFERRED",
                                      "SKIPPED",
                                      "BLOCKED",
                                      "FAILED"
                                    ]
                                  },
                                  "reason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            },
                            "carriedCompletionModes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "completionMode",
                                  "fromCourseVersionIds"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "completionMode": {
                                    "type": "string"
                                  },
                                  "fromCourseVersionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            },
                            "recordedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "pendingQueued": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/versions": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsCourseVersions",
        "summary": "List immutable LMS course versions",
        "description": "Requires `lms:read`; versions include the exact frozen course tree, content hash, authorized canonical human-navigation links, and `attribution` (author of the published draft revision and publisher).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published versions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "required": [
                          "attribution"
                        ],
                        "properties": {
                          "links": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/LmsCanonicalLink"
                            }
                          },
                          "attribution": {
                            "$ref": "#/components/schemas/LmsCourseVersionAttribution"
                          },
                          "authoringDecision": {
                            "type": "object",
                            "properties": {
                              "decision": {
                                "type": "object",
                                "properties": {
                                  "schemaVersion": {
                                    "type": "number",
                                    "const": 1
                                  },
                                  "deliveryPath": {
                                    "type": "string",
                                    "enum": [
                                      "STANDALONE_FORM",
                                      "COURSE",
                                      "INDIVIDUAL_RETRAINING"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "ONBOARDING",
                                      "PRODUCTION_ENABLEMENT",
                                      "REFRESHER",
                                      "CORRECTIVE_RETRAINING",
                                      "QUALIFICATION"
                                    ]
                                  },
                                  "assessment": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "model": {
                                            "type": "string",
                                            "const": "CONTENT_ONLY"
                                          }
                                        },
                                        "required": [
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "model": {
                                            "type": "string",
                                            "const": "FORMATIVE_PRACTICE"
                                          },
                                          "explanationTiming": {
                                            "type": "string",
                                            "const": "AFTER_SUBMISSION"
                                          }
                                        },
                                        "required": [
                                          "model",
                                          "explanationTiming"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "passThresholdPercent": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 100
                                          },
                                          "attemptLimit": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 10
                                          },
                                          "cooldownStepsSeconds": {
                                            "minItems": 1,
                                            "maxItems": 10,
                                            "type": "array",
                                            "items": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 3600
                                            }
                                          },
                                          "restartScope": {
                                            "type": "string",
                                            "enum": [
                                              "WHOLE_MODULE",
                                              "MISSED_QUESTIONS"
                                            ]
                                          },
                                          "resultTiming": {
                                            "type": "string",
                                            "const": "IMMEDIATE"
                                          },
                                          "model": {
                                            "type": "string",
                                            "const": "AUTO_MASTERY"
                                          }
                                        },
                                        "required": [
                                          "passThresholdPercent",
                                          "attemptLimit",
                                          "cooldownStepsSeconds",
                                          "restartScope",
                                          "resultTiming",
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "autoWeightPercent": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99
                                          },
                                          "rubric": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "resultRelease": {
                                            "type": "string",
                                            "enum": [
                                              "IMMEDIATE",
                                              "MANUAL"
                                            ]
                                          },
                                          "returnPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "REVISE_AND_RESUBMIT",
                                              "NO_RETURN"
                                            ]
                                          },
                                          "completionPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "SYSTEM",
                                              "EMPLOYER_REVIEW"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "const": "MIXED_QUALIFICATION"
                                          }
                                        },
                                        "required": [
                                          "autoWeightPercent",
                                          "rubric",
                                          "resultRelease",
                                          "returnPolicy",
                                          "completionPolicy",
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "autoWeightPercent": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99
                                          },
                                          "rubric": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "resultRelease": {
                                            "type": "string",
                                            "enum": [
                                              "IMMEDIATE",
                                              "MANUAL"
                                            ]
                                          },
                                          "returnPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "REVISE_AND_RESUBMIT",
                                              "NO_RETURN"
                                            ]
                                          },
                                          "completionPolicy": {
                                            "type": "string",
                                            "enum": [
                                              "SYSTEM",
                                              "EMPLOYER_REVIEW"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "const": "MANUAL_APPLIED"
                                          }
                                        },
                                        "required": [
                                          "autoWeightPercent",
                                          "rubric",
                                          "resultRelease",
                                          "returnPolicy",
                                          "completionPolicy",
                                          "model"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  "skillGap": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "required": [
                                  "schemaVersion",
                                  "deliveryPath",
                                  "purpose",
                                  "assessment"
                                ],
                                "additionalProperties": false
                              },
                              "planHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "summary": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 8000
                              },
                              "confirmedByUserId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "decision",
                              "planHash",
                              "summary",
                              "confirmedByUserId"
                            ],
                            "additionalProperties": false
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/versions/{versionId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsCourseVersion",
        "summary": "Read one immutable LMS course version",
        "description": "Requires `lms:read`; both course and version are tenant-scoped. Returns the immutable version (its frozen tree IS the complete content inventory: every ASSESSMENT lesson pins formId/formVersionId/formVersionNumber/formContentHash and every lesson lists its private assetIds), its `attribution` (author of the published draft revision and publisher), authorized canonical human-navigation links, and ordered modules whose mastery eligibility and stable ineligibility reason come from the same canonical validator used during assignment.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published version with mastery eligibility",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "version",
                    "modules"
                  ],
                  "properties": {
                    "version": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "attribution"
                      ],
                      "properties": {
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LmsCanonicalLink"
                          }
                        },
                        "attribution": {
                          "$ref": "#/components/schemas/LmsCourseVersionAttribution"
                        },
                        "authoringDecision": {
                          "type": "object",
                          "properties": {
                            "decision": {
                              "type": "object",
                              "properties": {
                                "schemaVersion": {
                                  "type": "number",
                                  "const": 1
                                },
                                "deliveryPath": {
                                  "type": "string",
                                  "enum": [
                                    "STANDALONE_FORM",
                                    "COURSE",
                                    "INDIVIDUAL_RETRAINING"
                                  ]
                                },
                                "purpose": {
                                  "type": "string",
                                  "enum": [
                                    "ONBOARDING",
                                    "PRODUCTION_ENABLEMENT",
                                    "REFRESHER",
                                    "CORRECTIVE_RETRAINING",
                                    "QUALIFICATION"
                                  ]
                                },
                                "assessment": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "model": {
                                          "type": "string",
                                          "const": "CONTENT_ONLY"
                                        }
                                      },
                                      "required": [
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "model": {
                                          "type": "string",
                                          "const": "FORMATIVE_PRACTICE"
                                        },
                                        "explanationTiming": {
                                          "type": "string",
                                          "const": "AFTER_SUBMISSION"
                                        }
                                      },
                                      "required": [
                                        "model",
                                        "explanationTiming"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "passThresholdPercent": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 100
                                        },
                                        "attemptLimit": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 10
                                        },
                                        "cooldownStepsSeconds": {
                                          "minItems": 1,
                                          "maxItems": 10,
                                          "type": "array",
                                          "items": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 3600
                                          }
                                        },
                                        "restartScope": {
                                          "type": "string",
                                          "enum": [
                                            "WHOLE_MODULE",
                                            "MISSED_QUESTIONS"
                                          ]
                                        },
                                        "resultTiming": {
                                          "type": "string",
                                          "const": "IMMEDIATE"
                                        },
                                        "model": {
                                          "type": "string",
                                          "const": "AUTO_MASTERY"
                                        }
                                      },
                                      "required": [
                                        "passThresholdPercent",
                                        "attemptLimit",
                                        "cooldownStepsSeconds",
                                        "restartScope",
                                        "resultTiming",
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "autoWeightPercent": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 99
                                        },
                                        "rubric": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "resultRelease": {
                                          "type": "string",
                                          "enum": [
                                            "IMMEDIATE",
                                            "MANUAL"
                                          ]
                                        },
                                        "returnPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "REVISE_AND_RESUBMIT",
                                            "NO_RETURN"
                                          ]
                                        },
                                        "completionPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "SYSTEM",
                                            "EMPLOYER_REVIEW"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "const": "MIXED_QUALIFICATION"
                                        }
                                      },
                                      "required": [
                                        "autoWeightPercent",
                                        "rubric",
                                        "resultRelease",
                                        "returnPolicy",
                                        "completionPolicy",
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "autoWeightPercent": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 99
                                        },
                                        "rubric": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "resultRelease": {
                                          "type": "string",
                                          "enum": [
                                            "IMMEDIATE",
                                            "MANUAL"
                                          ]
                                        },
                                        "returnPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "REVISE_AND_RESUBMIT",
                                            "NO_RETURN"
                                          ]
                                        },
                                        "completionPolicy": {
                                          "type": "string",
                                          "enum": [
                                            "SYSTEM",
                                            "EMPLOYER_REVIEW"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "const": "MANUAL_APPLIED"
                                        }
                                      },
                                      "required": [
                                        "autoWeightPercent",
                                        "rubric",
                                        "resultRelease",
                                        "returnPolicy",
                                        "completionPolicy",
                                        "model"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "skillGap": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000
                                }
                              },
                              "required": [
                                "schemaVersion",
                                "deliveryPath",
                                "purpose",
                                "assessment"
                              ],
                              "additionalProperties": false
                            },
                            "planHash": {
                              "type": "string",
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "summary": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 8000
                            },
                            "confirmedByUserId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "decision",
                            "planHash",
                            "summary",
                            "confirmedByUserId"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "modules": {
                      "oneOf": [
                        {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LmsVersionModule"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/answer-key": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsCourseAnswerKey",
        "summary": "Read the employer-only answer key for a course",
        "description": "Requires `lms:read`. Employer-only answer key for every quiz lesson, in course order: each question with its choices (correct choices marked), the expected value and matching notes for non-choice auto-graded questions, points, and each quiz pass rule. Omit `versionId` to read the current draft; quizzes resolve the way publishing would freeze them (the same pins Preview uses), and a quiz with no publishable version reports a `problem` instead of a key. Pass `versionId` to read one published version of this course from its immutable pins (404 when the version does not belong to this course). Read-only. Never shown to workers; the worker-facing Preview still hides answer keys.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "in": "query",
            "required": false,
            "description": "Published course version id. Omit to read the current draft as publishing would freeze it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Course answer key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "answerKey"
                  ],
                  "properties": {
                    "answerKey": {
                      "$ref": "#/components/schemas/LmsCourseAnswerKey"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/assets": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsAssets",
        "summary": "List uploaded course assets",
        "description": "Requires `lms:read`. Each asset reports kind, lifecycle status (RESERVED/READY/FAILED), MIME type, byte size, sha256 checksum, and file name. Storage buckets, paths, and signed URLs are never exposed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Course assets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "uploadLmsCourseAsset",
        "summary": "Upload a private LMS course asset",
        "description": "Requires `lms:write` and `Idempotency-Key`. The legacy buffered multipart upload is conservatively capped at 3 MiB; use prepare/upload/finalize for larger media. Bytes are sniffed and validated by kind (IMAGE, VIDEO, FILE) before the stable asset ID can enter a draft.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "kind",
                  "file"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "IMAGE",
                      "AUDIO",
                      "VIDEO",
                      "FILE"
                    ]
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Uploaded asset",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asset": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Asset exceeds route cap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/assets/uploads": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "prepareLmsAssetUpload",
        "summary": "Prepare a direct-to-storage asset upload (reserve + short-lived grant)",
        "description": "Requires `lms:write` and `Idempotency-Key`. Step 1 of the canonical prepare → upload → finalize workflow for large media. Per-kind domain ceilings are reported separately from the effective direct-upload maximum (currently 256 MiB for VIDEO, bounded by the production storage project). Idempotently reserves the asset and mints a short-lived tenant-scoped upload grant: a single signed PUT URL and an equivalent TUS resumable authorization (fixed 6 MiB chunks, interrupt/resume via the server-reported offset). Replaying the key recovers the same reservation; `status: READY` means the upload already committed and no grant is returned. Treat the grant as a secret in transit — never log or persist it.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "kind",
                  "fileName",
                  "contentType",
                  "sizeBytes"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "IMAGE",
                      "AUDIO",
                      "VIDEO",
                      "FILE"
                    ]
                  },
                  "fileName": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "contentType": {
                    "type": "string"
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Reservation with upload grant (or READY replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "READY",
                        "RESERVED"
                      ]
                    },
                    "asset": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "upload": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/assets/{assetId}/finalize": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "finalizeLmsAssetUpload",
        "summary": "Finalize a direct upload (server-verified commit to READY)",
        "description": "Requires `lms:write` and `Idempotency-Key`; a response-timeout retry with the same key replays one durable receipt. Step 3 of the direct workflow. The server independently verifies what storage actually holds — observed length, a streamed SHA-256 of the stored bytes, and a bounded container-signature sniff — before committing READY; the optional `expectedSha256` is a client cross-check only, never trusted as proof. A duplicate finalize returns the original READY asset. A verification mismatch removes the stored object and fails the reservation closed; recover with a fresh prepare under a new Idempotency-Key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedSha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed asset",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asset": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/assets/{assetId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsAsset",
        "summary": "Inspect one uploaded asset with references and removability",
        "description": "Requires `lms:read`. Reports the asset lifecycle detail plus its references: current-draft lesson keys using it, immutable published-version pin count and bounded pinned version IDs, and `removable` with explicit `removalBlockers` (PINNED_BY_PUBLISHED_VERSION, REFERENCED_BY_DRAFT, DRAFT_UNVERIFIABLE, RESERVATION_IN_FLIGHT). Storage coordinates are never exposed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Asset inspection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Asset not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/assets/{assetId}/manage": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "manageLmsAsset",
        "summary": "Reference-checked removal of one unreferenced asset",
        "description": "Requires `lms:write`, `Idempotency-Key`, and explicit `confirmRemove: true`. Removal is refused while any published version pins the asset (publish history is immutable), while the current draft references it, or while its reservation is still in flight; the draft scan runs under the same course lock as draft saves so a concurrent edit cannot race a broken reference. Safe replacement is upload-new → revision-guarded draft swap → validate → remove the old asset only once `removable` reads true. Bytes are NEVER overwritten behind an existing asset ID.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "action",
                  "confirmRemove"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "remove_unreferenced"
                    ]
                  },
                  "confirmRemove": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Removal receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Asset not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Asset referenced, pinned, or reservation in flight",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsAssessments",
        "summary": "List standalone LMS assessments",
        "description": "Requires `lms:read`. Returns organization-scoped Native Forms and authorized canonical links for published course placements.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Assessments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "assessments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "links": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/LmsCanonicalLink"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "createLmsAssessment",
        "summary": "Create an LMS Native Forms assessment",
        "description": "Requires `lms:write` and `Idempotency-Key`. Uses Native Forms as the only assessment/scoring engine.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title",
                  "definition",
                  "settings"
                ],
                "properties": {
                  "confirmedPlan": {
                    "type": "object",
                    "properties": {
                      "decision": {
                        "type": "object",
                        "properties": {
                          "schemaVersion": {
                            "type": "number",
                            "const": 1
                          },
                          "deliveryPath": {
                            "type": "string",
                            "enum": [
                              "STANDALONE_FORM",
                              "COURSE",
                              "INDIVIDUAL_RETRAINING"
                            ]
                          },
                          "purpose": {
                            "type": "string",
                            "enum": [
                              "ONBOARDING",
                              "PRODUCTION_ENABLEMENT",
                              "REFRESHER",
                              "CORRECTIVE_RETRAINING",
                              "QUALIFICATION"
                            ]
                          },
                          "assessment": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "model": {
                                    "type": "string",
                                    "const": "CONTENT_ONLY"
                                  }
                                },
                                "required": [
                                  "model"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "model": {
                                    "type": "string",
                                    "const": "FORMATIVE_PRACTICE"
                                  },
                                  "explanationTiming": {
                                    "type": "string",
                                    "const": "AFTER_SUBMISSION"
                                  }
                                },
                                "required": [
                                  "model",
                                  "explanationTiming"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "passThresholdPercent": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "attemptLimit": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 10
                                  },
                                  "cooldownStepsSeconds": {
                                    "minItems": 1,
                                    "maxItems": 10,
                                    "type": "array",
                                    "items": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3600
                                    }
                                  },
                                  "restartScope": {
                                    "type": "string",
                                    "enum": [
                                      "WHOLE_MODULE",
                                      "MISSED_QUESTIONS"
                                    ]
                                  },
                                  "resultTiming": {
                                    "type": "string",
                                    "const": "IMMEDIATE"
                                  },
                                  "model": {
                                    "type": "string",
                                    "const": "AUTO_MASTERY"
                                  }
                                },
                                "required": [
                                  "passThresholdPercent",
                                  "attemptLimit",
                                  "cooldownStepsSeconds",
                                  "restartScope",
                                  "resultTiming",
                                  "model"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "autoWeightPercent": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "rubric": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 4000
                                  },
                                  "resultRelease": {
                                    "type": "string",
                                    "enum": [
                                      "IMMEDIATE",
                                      "MANUAL"
                                    ]
                                  },
                                  "returnPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "REVISE_AND_RESUBMIT",
                                      "NO_RETURN"
                                    ]
                                  },
                                  "completionPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "SYSTEM",
                                      "EMPLOYER_REVIEW"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "const": "MIXED_QUALIFICATION"
                                  }
                                },
                                "required": [
                                  "autoWeightPercent",
                                  "rubric",
                                  "resultRelease",
                                  "returnPolicy",
                                  "completionPolicy",
                                  "model"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "autoWeightPercent": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "rubric": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 4000
                                  },
                                  "resultRelease": {
                                    "type": "string",
                                    "enum": [
                                      "IMMEDIATE",
                                      "MANUAL"
                                    ]
                                  },
                                  "returnPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "REVISE_AND_RESUBMIT",
                                      "NO_RETURN"
                                    ]
                                  },
                                  "completionPolicy": {
                                    "type": "string",
                                    "enum": [
                                      "SYSTEM",
                                      "EMPLOYER_REVIEW"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "const": "MANUAL_APPLIED"
                                  }
                                },
                                "required": [
                                  "autoWeightPercent",
                                  "rubric",
                                  "resultRelease",
                                  "returnPolicy",
                                  "completionPolicy",
                                  "model"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "skillGap": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "required": [
                          "schemaVersion",
                          "deliveryPath",
                          "purpose",
                          "assessment"
                        ],
                        "additionalProperties": false
                      },
                      "planHash": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "confirm": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "decision",
                      "planHash",
                      "confirm"
                    ],
                    "additionalProperties": false,
                    "description": "Required only when LMS_REQUIRE_CONFIRMED_LEARNING_PLAN=true. Default warn mode admits omission without storing a decision and returns learningPlan guidance. Supplied plans are always validated."
                  },
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "descriptionDoc": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "definition": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "settings": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created assessment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "assessment"
                  ],
                  "properties": {
                    "assessment": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "learningPlan": {
                      "type": "object",
                      "properties": {
                        "required": {
                          "type": "boolean",
                          "const": false
                        },
                        "missing": {
                          "type": "boolean",
                          "const": true
                        },
                        "next": {
                          "type": "string",
                          "const": "lms.authoring.plan"
                        }
                      },
                      "required": [
                        "required",
                        "missing",
                        "next"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid assessment or confirmation shape",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "CONFLICT with details.reason LEARNING_PLAN_REQUIRED: missing plan when enforcement is enabled, or an invalid, changed, cross-organization or wrong-target supplied plan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments/{formId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsAssessment",
        "summary": "Read an LMS assessment draft and versions",
        "description": "Requires `lms:read`; job-scoped forms are not exposed through this LMS catalog. Includes authorized canonical links for published course placements.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Assessment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "assessment": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LmsCanonicalLink"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "lms"
        ],
        "operationId": "updateLmsAssessment",
        "summary": "Update an LMS assessment draft (revision-fenced, receipt-backed)",
        "description": "Requires `lms:write` and `Idempotency-Key` (durable-receipt contract). Body: {expectedRevision, title, description?, descriptionDoc?, definition, settings}. `expectedRevision` keeps guarding concurrent editors; the durable receipt lets a response-timeout retry with the SAME key + payload replay its own result instead of tripping the revision conflict, and key reuse with a changed payload is a 409. Question answer keys live only in the employer draft/definition and are never exposed to learners.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedRevision",
                  "title",
                  "definition",
                  "settings"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "descriptionDoc": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "definition": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "settings": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated assessment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Revision conflict or idempotency key reuse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments/{formId}/publish": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "publishLmsAssessment",
        "summary": "Publish an immutable Native Form assessment version",
        "description": "Requires `lms:write`, `Idempotency-Key`, expectedDraftRevision, and explicit `confirmPublish: true`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedDraftRevision",
                  "confirmPublish"
                ],
                "properties": {
                  "expectedDraftRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "confirmPublish": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Published assessment version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments/{formId}/archive": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "archiveLmsAssessment",
        "summary": "Archive a Native Form assessment (soft delete)",
        "description": "Requires `lms:write` and `Idempotency-Key` (durable-receipt contract). Soft delete (DEV-4492): the draft and every published version stay readable and courses that pin a published version keep working, but LMS course validation refuses the form and new media uploads are rejected until it is restored. Idempotent: archiving an archived assessment changes nothing. The body is ignored. Response: {assessment, archived, replayed}.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "responses": {
          "200": {
            "description": "Archived assessment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments/{formId}/unarchive": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "unarchiveLmsAssessment",
        "summary": "Restore an archived Native Form assessment",
        "description": "Requires `lms:write` and `Idempotency-Key` (durable-receipt contract). Reverses `archive` (DEV-4492): course validation and media uploads accept the assessment again. Idempotent: restoring an active assessment changes nothing. The body is ignored. Response: {assessment, archived, replayed}.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "responses": {
          "200": {
            "description": "Restored assessment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments/{formId}/assets": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsAssessmentAssets",
        "summary": "List an assessment’s media assets (image, audio, video)",
        "description": "Requires `lms:read` and organization ownership of the assessment. Lists every uploaded media asset for the form with its kind, lifecycle status (PENDING until finalize verifies the bytes, then READY), MIME type, byte size, image dimensions, and server-computed SHA-256. Asset ids are what a question’s `promptDoc` references in `image`, `audio` and `video` nodes; they are pinned to the published version at publish time.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Assessment assets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments/{formId}/assets/prepare": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "prepareLmsAssessmentAssetUpload",
        "summary": "Reserve a quiz media asset and mint a short-lived direct-upload grant",
        "description": "Requires `lms:write`, `Idempotency-Key`, and organization ownership of the assessment. Step 1 of 3 (prepare → upload → finalize): validates `kind` (IMAGE | AUDIO | VIDEO) against the per-kind MIME allowlist and ceiling (images 5 MiB, audio 32 MiB, video 256 MiB), reserves a PENDING asset under a DETERMINISTIC id for (principal, key) so retries converge on the same reservation and object path, and returns a fresh path-scoped grant (signed single PUT, or TUS resumable via the same token; provider-fixed 2h TTL, upsert DISABLED). Bytes never pass through this API. Replaying the key returns `status: READY` and no grant once the upload has been finalized.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "kind",
                  "fileName",
                  "contentType",
                  "sizeBytes"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "IMAGE",
                      "AUDIO",
                      "VIDEO"
                    ]
                  },
                  "fileName": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "contentType": {
                    "type": "string"
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Reservation + fresh upload grant",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Unsupported MIME type for the kind, or missing Idempotency-Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Reservation invalidated by a failed verification — start fresh",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Declared size exceeds the kind ceiling",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assessments/{formId}/assets/{assetId}/finalize": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "finalizeLmsAssessmentAssetUpload",
        "summary": "Verify the uploaded quiz media server-side and commit it READY",
        "description": "Requires `lms:write`, `Idempotency-Key`, and organization ownership of the assessment; bound to the reservation owner. Step 3 of 3: independently reads the stored object (bounded, no-store), enforces the reserved size, the declared MIME type, the container signature for the kind (image probe with dimensions; RIFF/WAVE, MPEG, OggS or M4A for audio; ISO-BMFF or EBML for video), and a server-computed SHA-256 before a CONDITIONAL PENDING→READY commit. Invalid bytes invalidate the reservation DB-first (recovery is a new key). A wrong optional `expectedSha256` over valid bytes is a typed CHECKSUM_MISMATCH that leaves the reservation PENDING. Duplicate finalize returns the committed asset.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "expectedSha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified asset",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Asset missing, foreign, or reserved by another actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_INCOMPLETE (nothing stored yet), VERIFICATION_FAILED (transient — retry), or CHECKSUM_MISMATCH",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid bytes — reservation invalidated; start a new upload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/roster": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsRoster",
        "summary": "List masked workers eligible for job Training assignment",
        "description": "Requires `lms:read` and employer access to the job. Returns a bounded, paginated roster with masked display names, contract IDs, active/ended status, and canonical assignability. It never returns worker email addresses.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Masked assignable roster",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "workers",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "workers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsRosterEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/plan": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "planLmsAssignment",
        "summary": "Plan one LMS assignment without writing",
        "description": "Requires `lms:write`. This is a zero-write preflight: it validates the exact job/course/version/module/audience request through the canonical assignment validator, shows recipient and Project To-do effects, and returns a short-lived signed receipt plus request hash. It creates no assignments, progress, attempts, notifications, events, or audit mutations and therefore requires no Idempotency-Key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LmsAssignmentPlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "No-write assignment plan",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "plan"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "plan": {
                      "$ref": "#/components/schemas/LmsAssignmentPlanReceipt"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Version, eligibility, audience, or tenant conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/export": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "exportLmsAssignments",
        "summary": "Export masked LMS assignment and mastery reporting rows",
        "description": "Requires `lms:read` and employer access to jobId. Returns at most 5,000 formula-neutralized rows per page as CSV, JSON, or JSONL, including employer-safe mastery counters. Worker names follow existing masking rules; email addresses, answer keys, correct values, prior wrong values, and raw question data are never included.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json",
                "jsonl"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000,
              "default": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded assignment export",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "format",
                    "rows",
                    "content",
                    "rowCount",
                    "nextCursor"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "csv",
                        "json",
                        "jsonl"
                      ]
                    },
                    "rows": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rowCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 5000
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsAssignments",
        "summary": "List LMS Project To-do assignments for a job",
        "description": "Requires `lms:read` and employer access to jobId. Returns authorized employer-review and learner in-shell links. Project To-dos remain the sole assignment/unassignment control plane. Pages are bounded (limit 1-200, default 50, newest assignment first) and carry `hasMore` plus `nextCursor`; a page with `hasMore: true` is PARTIAL and must be continued with `cursor`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Assignments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "links",
                    "assignments",
                    "hasMore",
                    "nextCursor"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsCanonicalLink"
                      }
                    },
                    "assignments": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsAssignmentRecord"
                      }
                    },
                    "hasMore": {
                      "type": "boolean",
                      "description": "True when a further page exists; `nextCursor` is then non-null. Never treat a page with hasMore=true as the complete learner population."
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "createLmsAssignment",
        "summary": "Assign an exact published course version through Project To-dos",
        "description": "Requires `lms:write`, `Idempotency-Key`, expectedCourseVersionId, and explicit `confirmAssign: true`. Audience uses canonical Project To-do values ACTIVE, FUTURE, ACTIVE_AND_FUTURE, or SELECTED. Assignment pins the exact version and may scope selected modules. Mastery is opt-in, works for any audience (FUTURE and ACTIVE_AND_FUTURE auto-assign every future hire) and for the whole course or a module subset, and additionally requires an auto-gradable in-scope assessment set, SYSTEM completion, a 1-10 run limit, and the signed receipt returned by the no-write plan. Each recipient gets an independent per-contract mastery binding. Retraining cases stay one SELECTED contract and one module. Optional `unlocksItemIds` (max 10) names existing Project To-dos that stay locked for each person until they complete this training (the token then also needs `project_todos:write`); the training is added as their prerequisite in the same transaction, unfinished copies re-lock, and the plan lists each target and warns when some holders are not getting the training.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jobId",
                  "courseId",
                  "expectedCourseVersionId",
                  "completionPolicy",
                  "audience",
                  "confirmAssign"
                ],
                "properties": {
                  "jobId": {
                    "type": "string"
                  },
                  "courseId": {
                    "type": "string"
                  },
                  "expectedCourseVersionId": {
                    "type": "string"
                  },
                  "moduleKeys": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50
                  },
                  "completionPolicy": {
                    "type": "string",
                    "enum": [
                      "SYSTEM",
                      "EMPLOYER_REVIEW"
                    ]
                  },
                  "categoryId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "audience": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "FUTURE",
                      "ACTIVE_AND_FUTURE",
                      "SELECTED"
                    ]
                  },
                  "selectedContractIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 500
                  },
                  "required": {
                    "type": "boolean",
                    "default": true
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "NORMAL",
                      "HIGH",
                      "URGENT"
                    ]
                  },
                  "blockingMode": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "IMMEDIATE",
                      "AFTER_DUE"
                    ]
                  },
                  "dueOffsetMinutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 525600
                  },
                  "unlocksItemIds": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string"
                    },
                    "description": "Existing Project To-do item ids on the job that stay locked for each person until they complete this training. The training is added as a prerequisite in the same transaction; unfinished copies re-lock until it is done. When sent, the token also needs `project_todos:read` to plan and `project_todos:write` to create."
                  },
                  "masteryMode": {
                    "type": "boolean"
                  },
                  "masteryRunLimit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10,
                    "default": 3
                  },
                  "masteryAntiGuessPolicy": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "schemaVersion",
                      "cooldownStepsSeconds",
                      "restartScope"
                    ],
                    "properties": {
                      "schemaVersion": {
                        "type": "integer",
                        "enum": [
                          1
                        ]
                      },
                      "cooldownStepsSeconds": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 10,
                        "items": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 3600
                        }
                      },
                      "restartScope": {
                        "type": "string",
                        "enum": [
                          "WHOLE_MODULE",
                          "MISSED_QUESTIONS"
                        ]
                      }
                    }
                  },
                  "planReceiptToken": {
                    "type": "string",
                    "description": "Required for mastery: signed token from POST /lms/assignments/plan."
                  },
                  "confirmAssign": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Project To-do assignment fan-out result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "assignment",
                    "replayed",
                    "requestHash"
                  ],
                  "properties": {
                    "assignment": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "itemId",
                        "versionId",
                        "matchedContracts",
                        "createdAssignments",
                        "assignmentIds"
                      ],
                      "properties": {
                        "itemId": {
                          "type": "string"
                        },
                        "versionId": {
                          "type": "string"
                        },
                        "matchedContracts": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "createdAssignments": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "assignmentIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "unlocked": {
                          "type": "array",
                          "description": "To-dos that now unlock after this training (present only when unlocksItemIds was sent).",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "itemId",
                              "changed",
                              "relockedCount"
                            ],
                            "properties": {
                              "itemId": {
                                "type": "string"
                              },
                              "changed": {
                                "type": "boolean"
                              },
                              "relockedCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            }
                          }
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "requestHash": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Toggle, link, version, scope, or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsAssignment",
        "summary": "Read one tenant-scoped LMS assignment",
        "description": "Requires `lms:read`; returns Project To-do status, LMS lesson progress, authorized employer-review and learner in-shell links, and per-lesson `assessmentResults` through the worker-safe released-result projection: scores, per-question detail, grading notes, and overall feedback appear only after the explicit result release; retry state is computed live from the attempt policy plus canonical RETURN grants. Answer keys are never serialized.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Assignment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "assignment"
                  ],
                  "properties": {
                    "assignment": {
                      "$ref": "#/components/schemas/LmsAssignmentRecord"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/runs": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsAssignmentRuns",
        "summary": "List immutable mastery runs for one assignment",
        "description": "Requires `lms:read` and tenant access to the assignment. The bounded history contains immutable run IDs, run numbers, statuses, timestamps, and aggregate wrong/unanswered counts only. It never returns answers, correct values, question scores, or another worker’s data.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paged immutable run history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "assignmentId",
                    "runs",
                    "nextCursor"
                  ],
                  "properties": {
                    "assignmentId": {
                      "type": "string"
                    },
                    "runs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsCourseRun"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Assignment not found or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/attempts": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsAttemptEvidence",
        "summary": "List immutable historical attempts for one LMS assignment",
        "description": "`assignmentId` is the enrollment key: a Project To-do assignment id, or `proposal:<jobOfferId>` for an application-stage screening enrollment (a screening review’s `attemptHistory` ids open here). Requires `lms:read` and employer access to the assignment’s job (organization membership alone is insufficient). Bounded, deterministically ordered attempt history; legacy attempts predating LMS pinning appear with `lessonKey: null`. Cross-tenant/unknown assignments read as a non-enumerating 404. Per-question evidence lives on the detail endpoint.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lessonKey",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Stable lesson key filter (history is keyed across course releases)."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable attempt history page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "assignmentId",
                    "attempts",
                    "nextCursor"
                  ],
                  "properties": {
                    "assignmentId": {
                      "type": "string"
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "attemptId",
                          "lessonKey",
                          "attemptNumber",
                          "status",
                          "startedAt",
                          "submittedAt",
                          "formVersionId",
                          "pins",
                          "mastery",
                          "resultReleaseState",
                          "resultReleasedAt",
                          "projection"
                        ],
                        "properties": {
                          "attemptId": {
                            "type": "string"
                          },
                          "lessonKey": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "attemptNumber": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string"
                          },
                          "startedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "submittedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "formVersionId": {
                            "type": "string"
                          },
                          "pins": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "courseId",
                              "courseVersionId",
                              "courseVersionNumber",
                              "courseTitle",
                              "releaseId",
                              "moduleKey",
                              "lessonKey"
                            ],
                            "properties": {
                              "courseId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "courseVersionId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "courseVersionNumber": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "courseTitle": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "releaseId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "moduleKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "lessonKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "mastery": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "runId",
                              "runNumber",
                              "runStatus"
                            ],
                            "properties": {
                              "runId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "runNumber": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "runStatus": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "resultReleaseState": {
                            "type": "string",
                            "enum": [
                              "NOT_APPLICABLE",
                              "HELD",
                              "RELEASED"
                            ]
                          },
                          "resultReleasedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "projection": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "state",
                              "earnedPoints",
                              "possiblePoints",
                              "passed"
                            ],
                            "properties": {
                              "state": {
                                "type": "string"
                              },
                              "earnedPoints": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "possiblePoints": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "passed": {
                                "type": [
                                  "boolean",
                                  "null"
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, family disabled, or not an employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment not found OR outside your organization (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/attempts/{attemptId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsAttemptEvidence",
        "summary": "Read one immutable LMS attempt with per-question evidence",
        "description": "`assignmentId` is the enrollment key: a Project To-do assignment id, or `proposal:<jobOfferId>` for an application-stage screening enrollment. Requires `lms:read` and employer access to the assignment’s job. Evidence renders from the attempt’s OWN immutable form version (a later course release can never rewrite history): the immutable SAFE question snapshot (`required`, structured option `id`/`label` pairs for option questions, and `scale` bounds/labels for LINEAR_SCALE — never inferred from responseText), exact stored responses, canonical human-readable rendering, closed per-question outcome vocabulary (CORRECT | INCORRECT | UNANSWERED | AWAITING_MANUAL_GRADE | NOT_GRADED), missed/unanswered question-id rollups, and the current manual grade with `gradedAt`/`gradedByUserId` from the append-only row. Discriminated by `evidenceState`: NOT_SUBMITTED attempts expose `questions: null` (drafts are never evidence). Answer keys, correct values, pass thresholds, and attempt policies are structurally absent. Unknown/cross-binding attempts read as a non-enumerating 404.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attemptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable attempt evidence",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "assignmentId",
                        "attemptId",
                        "lessonKey",
                        "attemptNumber",
                        "status",
                        "startedAt",
                        "submittedAt",
                        "resultReleasedAt",
                        "resultReleaseState",
                        "pins",
                        "mastery",
                        "workflow",
                        "formVersion",
                        "projection",
                        "evidenceState",
                        "questions",
                        "missedQuestionIds",
                        "unansweredQuestionIds"
                      ],
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "attemptId": {
                          "type": "string"
                        },
                        "lessonKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attemptNumber": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string"
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "submittedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "resultReleasedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "resultReleaseState": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE",
                            "HELD",
                            "RELEASED"
                          ]
                        },
                        "pins": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "courseId",
                            "courseVersionId",
                            "courseVersionNumber",
                            "courseTitle",
                            "releaseId",
                            "moduleKey",
                            "lessonKey"
                          ],
                          "properties": {
                            "courseId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "courseVersionId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "courseVersionNumber": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "courseTitle": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "releaseId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "moduleKey": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "lessonKey": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        },
                        "mastery": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "runId",
                            "runNumber",
                            "runStatus",
                            "runStartedAt",
                            "runSubmittedAt",
                            "wrongCount",
                            "unansweredCount"
                          ],
                          "properties": {
                            "runId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "runNumber": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "runStatus": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "runStartedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "runSubmittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "wrongCount": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "unansweredCount": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            }
                          }
                        },
                        "workflow": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "assignmentStatus",
                            "waitingOnRole",
                            "supersededByAssignmentId",
                            "superseded",
                            "latestEvent",
                            "latestReturn"
                          ],
                          "properties": {
                            "assignmentStatus": {
                              "type": "string"
                            },
                            "waitingOnRole": {
                              "type": "string"
                            },
                            "supersededByAssignmentId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "superseded": {
                              "type": "boolean"
                            },
                            "latestEvent": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "additionalProperties": false,
                              "required": [
                                "type",
                                "occurredAt",
                                "reason",
                                "previousStatus",
                                "nextStatus"
                              ],
                              "properties": {
                                "type": {
                                  "type": "string"
                                },
                                "occurredAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "reason": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "previousStatus": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "nextStatus": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              }
                            },
                            "latestReturn": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "additionalProperties": false,
                              "required": [
                                "occurredAt",
                                "reason"
                              ],
                              "properties": {
                                "occurredAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "reason": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              }
                            }
                          }
                        },
                        "formVersion": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "id",
                            "versionNumber",
                            "title"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "versionNumber": {
                              "type": "integer"
                            },
                            "title": {
                              "type": "string"
                            }
                          }
                        },
                        "projection": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "earnedPoints",
                            "possiblePoints",
                            "passed"
                          ],
                          "properties": {
                            "state": {
                              "type": "string"
                            },
                            "earnedPoints": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "possiblePoints": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "passed": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            }
                          }
                        },
                        "evidenceState": {
                          "type": "string",
                          "enum": [
                            "SUBMITTED"
                          ]
                        },
                        "questions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "questionId",
                              "type",
                              "prompt",
                              "required",
                              "options",
                              "scale",
                              "manualMaxPoints",
                              "answer",
                              "responseText",
                              "outcome",
                              "grade",
                              "currentManualGrade",
                              "masteryState"
                            ],
                            "properties": {
                              "questionId": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "prompt": {
                                "type": "string"
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "options": {
                                "type": [
                                  "array",
                                  "null"
                                ],
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "id",
                                    "label"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    }
                                  }
                                }
                              },
                              "scale": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "min",
                                  "max",
                                  "minLabel",
                                  "maxLabel"
                                ],
                                "properties": {
                                  "min": {
                                    "type": "integer"
                                  },
                                  "max": {
                                    "type": "integer"
                                  },
                                  "minLabel": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "maxLabel": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              },
                              "manualMaxPoints": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "answer": {
                                "description": "The exact stored response (raw answer JSON); null when unanswered."
                              },
                              "responseText": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "outcome": {
                                "type": "string",
                                "enum": [
                                  "CORRECT",
                                  "INCORRECT",
                                  "PARTIAL",
                                  "UNANSWERED",
                                  "AWAITING_MANUAL_GRADE",
                                  "NOT_GRADED"
                                ]
                              },
                              "grade": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "correct",
                                  "awardedPoints",
                                  "maxPoints",
                                  "manuallyGraded"
                                ],
                                "properties": {
                                  "correct": {
                                    "type": [
                                      "boolean",
                                      "null"
                                    ]
                                  },
                                  "awardedPoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "maxPoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "manuallyGraded": {
                                    "type": "boolean"
                                  }
                                }
                              },
                              "currentManualGrade": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "awardedPoints",
                                  "maxPoints",
                                  "reason",
                                  "gradedAt",
                                  "gradedByUserId"
                                ],
                                "properties": {
                                  "awardedPoints": {
                                    "type": "integer"
                                  },
                                  "maxPoints": {
                                    "type": "integer"
                                  },
                                  "reason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "gradedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "gradedByUserId": {
                                    "type": "string"
                                  }
                                }
                              },
                              "masteryState": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "carriedFromPriorRun",
                                  "lockedForNextRun",
                                  "redoInNextRun"
                                ],
                                "properties": {
                                  "carriedFromPriorRun": {
                                    "type": "boolean"
                                  },
                                  "lockedForNextRun": {
                                    "type": "boolean"
                                  },
                                  "redoInNextRun": {
                                    "type": "boolean"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "missedQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "unansweredQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "assignmentId",
                        "attemptId",
                        "lessonKey",
                        "attemptNumber",
                        "status",
                        "startedAt",
                        "submittedAt",
                        "resultReleasedAt",
                        "resultReleaseState",
                        "pins",
                        "mastery",
                        "workflow",
                        "formVersion",
                        "projection",
                        "evidenceState",
                        "questions",
                        "missedQuestionIds",
                        "unansweredQuestionIds"
                      ],
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "attemptId": {
                          "type": "string"
                        },
                        "lessonKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attemptNumber": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string"
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "submittedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "resultReleasedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "resultReleaseState": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE",
                            "HELD",
                            "RELEASED"
                          ]
                        },
                        "pins": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "courseId",
                            "courseVersionId",
                            "courseVersionNumber",
                            "courseTitle",
                            "releaseId",
                            "moduleKey",
                            "lessonKey"
                          ],
                          "properties": {
                            "courseId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "courseVersionId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "courseVersionNumber": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "courseTitle": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "releaseId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "moduleKey": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "lessonKey": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        },
                        "mastery": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "runId",
                            "runNumber",
                            "runStatus",
                            "runStartedAt",
                            "runSubmittedAt",
                            "wrongCount",
                            "unansweredCount"
                          ],
                          "properties": {
                            "runId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "runNumber": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "runStatus": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "runStartedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "runSubmittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "wrongCount": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "unansweredCount": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            }
                          }
                        },
                        "workflow": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "assignmentStatus",
                            "waitingOnRole",
                            "supersededByAssignmentId",
                            "superseded",
                            "latestEvent",
                            "latestReturn"
                          ],
                          "properties": {
                            "assignmentStatus": {
                              "type": "string"
                            },
                            "waitingOnRole": {
                              "type": "string"
                            },
                            "supersededByAssignmentId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "superseded": {
                              "type": "boolean"
                            },
                            "latestEvent": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "additionalProperties": false,
                              "required": [
                                "type",
                                "occurredAt",
                                "reason",
                                "previousStatus",
                                "nextStatus"
                              ],
                              "properties": {
                                "type": {
                                  "type": "string"
                                },
                                "occurredAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "reason": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "previousStatus": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "nextStatus": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              }
                            },
                            "latestReturn": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "additionalProperties": false,
                              "required": [
                                "occurredAt",
                                "reason"
                              ],
                              "properties": {
                                "occurredAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "reason": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              }
                            }
                          }
                        },
                        "formVersion": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "id",
                            "versionNumber",
                            "title"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "versionNumber": {
                              "type": "integer"
                            },
                            "title": {
                              "type": "string"
                            }
                          }
                        },
                        "projection": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "earnedPoints",
                            "possiblePoints",
                            "passed"
                          ],
                          "properties": {
                            "state": {
                              "type": "string"
                            },
                            "earnedPoints": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "possiblePoints": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "passed": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            }
                          }
                        },
                        "evidenceState": {
                          "type": "string",
                          "enum": [
                            "NOT_SUBMITTED"
                          ]
                        },
                        "questions": {
                          "type": "null"
                        },
                        "missedQuestionIds": {
                          "type": "null"
                        },
                        "unansweredQuestionIds": {
                          "type": "null"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, family disabled, or not an employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Attempt not found OR outside your organization (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/learner-activity": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsLearnerActivity",
        "summary": "List per-learner Training activity for one job",
        "description": "Requires `lms:read` and employer access to the job. Read-only projection per LMS assignment: masked learner names (first name + last initial only), lifecycle timestamps, the current module/lesson derived from the effective course tree (null for terminal COMPLETED/WAIVED/CLOSED/SUPERSEDED assignments), honest derived activity timestamps, and a monotonic `activityFingerprint` change detector for agent polling.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-learner activity page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "learners",
                    "nextCursor"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "learners": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "assignmentId",
                          "assignmentStatus",
                          "waitingOnRole",
                          "learner",
                          "lifecycle",
                          "currentLesson",
                          "progress",
                          "lastActivity",
                          "latestAssessment",
                          "activityFingerprint"
                        ],
                        "properties": {
                          "assignmentId": {
                            "type": "string"
                          },
                          "assignmentStatus": {
                            "type": "string"
                          },
                          "waitingOnRole": {
                            "type": "string",
                            "description": "Canonical Project To-do court: WORKER, EMPLOYER, or NONE."
                          },
                          "learner": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "contractId",
                              "workerUserId",
                              "displayName"
                            ],
                            "properties": {
                              "contractId": {
                                "type": "string"
                              },
                              "workerUserId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "displayName": {
                                "type": "string",
                                "description": "Masked: first name + last initial only."
                              }
                            }
                          },
                          "lifecycle": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "assignedAt",
                              "activatedAt",
                              "firstViewedAt",
                              "submittedAt",
                              "completedAt"
                            ],
                            "properties": {
                              "assignedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "activatedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "firstViewedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "submittedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "completedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            }
                          },
                          "currentLesson": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "moduleKey",
                              "moduleTitle",
                              "lessonKey",
                              "lessonTitle",
                              "status"
                            ],
                            "properties": {
                              "moduleKey": {
                                "type": "string"
                              },
                              "moduleTitle": {
                                "type": "string"
                              },
                              "lessonKey": {
                                "type": "string"
                              },
                              "lessonTitle": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            }
                          },
                          "progress": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "completedLessons",
                              "totalLessons",
                              "firstLessonStartedAt",
                              "mostRecentLessonCompletedAt",
                              "mostRecentAssessmentSubmittedAt",
                              "lastActivityAt"
                            ],
                            "properties": {
                              "completedLessons": {
                                "type": "integer"
                              },
                              "totalLessons": {
                                "type": "integer"
                              },
                              "firstLessonStartedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "mostRecentLessonCompletedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "mostRecentAssessmentSubmittedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "lastActivityAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            }
                          },
                          "lastActivity": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "occurredAt",
                              "lessonKey"
                            ],
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "occurredAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "lessonKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "latestAssessment": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "attemptId",
                              "lessonKey",
                              "attemptNumber",
                              "status",
                              "startedAt",
                              "submittedAt",
                              "resultReleasedAt",
                              "projection"
                            ],
                            "properties": {
                              "attemptId": {
                                "type": "string"
                              },
                              "lessonKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "attemptNumber": {
                                "type": "integer"
                              },
                              "status": {
                                "type": "string"
                              },
                              "startedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "submittedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "resultReleasedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "projection": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "state",
                                  "earnedPoints",
                                  "possiblePoints",
                                  "passed"
                                ],
                                "properties": {
                                  "state": {
                                    "type": "string"
                                  },
                                  "earnedPoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "possiblePoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "passed": {
                                    "type": [
                                      "boolean",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            }
                          },
                          "activityFingerprint": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "progressRevisionSum",
                              "progressRowCount",
                              "latestEventAt"
                            ],
                            "properties": {
                              "progressRevisionSum": {
                                "type": "integer"
                              },
                              "progressRowCount": {
                                "type": "integer"
                              },
                              "latestEventAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, family disabled, or not an employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/grading-queue": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsGradingQueue",
        "summary": "List LMS assessment attempts waiting on the employer across one job",
        "description": "DEV-2757. Requires `lms:read` and employer access to the job; an optional `courseId` must belong to your organization (a foreign or unknown course is a non-enumerating 404). READ-ONLY. Lists the hired workers’ CURRENT attempt of each LMS assessment lesson when it waits on the employer: `NEEDS_GRADING` (manual grading still owed), `HELD` (graded result on a MANUAL-release form not yet released) or `REVIEW_PENDING` (a required review decision not yet made). Excludes mastery runs, optional (ON_SUBMIT) lessons, superseded attempts and application-stage screening. Oldest `waitingSince` first, then attemptId. Rows carry masked \"First L.\" names only — never emails, answers, grades, form definitions, answer keys or reason text. Bounded cursor pages (default 50, max 200); a job with more than 5000 waiting attempts is refused (400 `details.lmsCode` GRADING_QUEUE_TOO_LARGE — narrow with `state` or `courseId`).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only this course (must belong to your organization)."
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEEDS_GRADING",
                "HELD",
                "REVIEW_PENDING"
              ]
            },
            "description": "Only one queue state."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Grading queue page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "description": "Sync-capable clients (send x-opentrain-agent-surface, e.g. CLI) receive sync and syncCoverage; jobs:read is independently required for attachment. Legacy clients without sync headers keep the original closed response. Every submit-time queue entry (NEEDS_GRADING, HELD or REVIEW_PENDING) emits a privacy-safe LMS_GRADING_REQUIRED change on normal JobOps sync; acknowledge only by presenting the delivered sync token on a later call.",
                  "required": [
                    "ok",
                    "jobId",
                    "items",
                    "hasMore",
                    "nextCursor"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "assignmentId",
                          "contractId",
                          "workerName",
                          "courseId",
                          "courseVersionId",
                          "moduleKey",
                          "lessonKey",
                          "lessonTitle",
                          "attemptId",
                          "attemptNumber",
                          "state",
                          "submittedAt",
                          "waitingSince"
                        ],
                        "properties": {
                          "assignmentId": {
                            "type": "string"
                          },
                          "contractId": {
                            "type": "string"
                          },
                          "workerName": {
                            "type": "string",
                            "description": "Masked \"First L.\" at the server boundary; never a full surname or email."
                          },
                          "courseId": {
                            "type": "string"
                          },
                          "courseVersionId": {
                            "type": "string",
                            "description": "The course version the attempt was taken on."
                          },
                          "moduleKey": {
                            "type": "string"
                          },
                          "lessonKey": {
                            "type": "string"
                          },
                          "lessonTitle": {
                            "type": "string"
                          },
                          "attemptId": {
                            "type": "string"
                          },
                          "attemptNumber": {
                            "type": "integer"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "NEEDS_GRADING",
                              "HELD",
                              "REVIEW_PENDING"
                            ]
                          },
                          "submittedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "waitingSince": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When the employer’s turn began: submittedAt (NEEDS_GRADING), grade finalization (HELD), or result release (REVIEW_PENDING)."
                          }
                        }
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque resume point; pass back as `cursor`. Null when hasMore is false."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query (state, page size), a queue past the scan bound (details.lmsCode GRADING_QUEUE_TOO_LARGE), or a cursor that is not a row of this queue — unknown, foreign, or the attempt has moved on since the previous page (code INVALID_CURSOR; restart from the first page)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, family disabled, or not an employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or course not found (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/courses/{courseId}/release-audit": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsReleaseAudit",
        "summary": "Audit one job cohort’s course release migration (source → destination)",
        "description": "DEV-2824. Requires `lms:read` and employer access to the job; the course and both versions must belong to your organization (a foreign course is a non-enumerating 404; an unknown version is a 404; an unpublished or identical version pair is a 400). READ-ONLY: never plans or applies a migration. Per learner (masked \"First L.\" names, no emails, answers or keys): origin/effective/desired release epochs, every recorded migration decision touching the audited pair (outcome, reason, actor, time), the carry plan of the release that landed the destination (counts by carry action and by lesson change kind, the policy used, and — with `includeLessons=true` — a per-lesson explanation such as \"Destination assessment uses a different form version; the verified source result was grandfathered\"), attempts attributed to the source vs destination release (plus carried vs native latest-attempt pointers and the latest attempt’s released projection), the current lesson, the last activity, and flags (pendingReview, failedAttempt, exhaustedRetry, blockedProgression, notMigrated). The cohort summary counts by latest decision outcome, by effective version and by flag; `cohortSize` is an exact database count and the derived buckets cover the newest 2000 assignments (`truncated` discloses a cut). Bounded cursor pages (default 50, max 200).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fromVersion",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The SOURCE published course version id (e.g. v1)."
          },
          {
            "name": "toVersion",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The DESTINATION published course version id (e.g. v3)."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "includeLessons",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Include the per-lesson carry plan and policy explanation on each learner."
          }
        ],
        "responses": {
          "200": {
            "description": "Cohort release audit page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "courseId",
                    "fromVersion",
                    "toVersion",
                    "asOf",
                    "summary",
                    "learners",
                    "nextCursor"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "courseId": {
                      "type": "string"
                    },
                    "fromVersion": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "courseVersionId",
                        "courseVersionNumber"
                      ],
                      "properties": {
                        "courseVersionId": {
                          "type": "string"
                        },
                        "courseVersionNumber": {
                          "type": "integer"
                        }
                      }
                    },
                    "toVersion": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "courseVersionId",
                        "courseVersionNumber"
                      ],
                      "properties": {
                        "courseVersionId": {
                          "type": "string"
                        },
                        "courseVersionNumber": {
                          "type": "integer"
                        }
                      }
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "summary": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "cohortSize",
                        "coveredAssignments",
                        "truncated",
                        "byOutcome",
                        "byEffectiveVersion",
                        "byFlag"
                      ],
                      "properties": {
                        "cohortSize": {
                          "type": "integer",
                          "description": "Exact database count of cohort assignments."
                        },
                        "coveredAssignments": {
                          "type": "integer",
                          "description": "Assignments the derived buckets cover (at most 2000, newest first)."
                        },
                        "truncated": {
                          "type": "boolean"
                        },
                        "byOutcome": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "APPLIED",
                            "DEFERRED",
                            "SKIPPED",
                            "BLOCKED",
                            "NONE"
                          ],
                          "properties": {
                            "APPLIED": {
                              "type": "integer"
                            },
                            "DEFERRED": {
                              "type": "integer"
                            },
                            "SKIPPED": {
                              "type": "integer"
                            },
                            "BLOCKED": {
                              "type": "integer"
                            },
                            "NONE": {
                              "type": "integer"
                            }
                          },
                          "description": "Latest recorded source→destination decision per assignment; NONE = no decision recorded."
                        },
                        "byEffectiveVersion": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "courseVersionId",
                              "courseVersionNumber",
                              "side",
                              "count"
                            ],
                            "properties": {
                              "courseVersionId": {
                                "type": "string"
                              },
                              "courseVersionNumber": {
                                "type": "integer"
                              },
                              "side": {
                                "type": "string",
                                "enum": [
                                  "SOURCE",
                                  "DESTINATION",
                                  "OTHER"
                                ]
                              },
                              "count": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "byFlag": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "pendingReview",
                            "failedAttempt",
                            "exhaustedRetry",
                            "blockedProgression",
                            "notMigrated"
                          ],
                          "properties": {
                            "pendingReview": {
                              "type": "integer"
                            },
                            "failedAttempt": {
                              "type": "integer"
                            },
                            "exhaustedRetry": {
                              "type": "integer"
                            },
                            "blockedProgression": {
                              "type": "integer"
                            },
                            "notMigrated": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "learners": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "assignmentId",
                          "assignmentStatus",
                          "waitingOnRole",
                          "bindingId",
                          "learner",
                          "releases",
                          "migrations",
                          "carry",
                          "attempts",
                          "currentLesson",
                          "lastActivity",
                          "flags"
                        ],
                        "properties": {
                          "assignmentId": {
                            "type": "string"
                          },
                          "assignmentStatus": {
                            "type": "string"
                          },
                          "waitingOnRole": {
                            "type": "string"
                          },
                          "bindingId": {
                            "type": "string"
                          },
                          "learner": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "contractId",
                              "workerUserId",
                              "displayName"
                            ],
                            "properties": {
                              "contractId": {
                                "type": "string"
                              },
                              "workerUserId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "displayName": {
                                "type": "string",
                                "description": "Masked: first name + last initial only."
                              }
                            }
                          },
                          "releases": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "origin",
                              "effective",
                              "desired",
                              "effectiveSide"
                            ],
                            "properties": {
                              "origin": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "releaseId",
                                  "releaseNumber",
                                  "courseVersionId",
                                  "courseVersionNumber"
                                ],
                                "properties": {
                                  "releaseId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Null only for an origin epoch whose row was never materialized."
                                  },
                                  "releaseNumber": {
                                    "type": "integer"
                                  },
                                  "courseVersionId": {
                                    "type": "string"
                                  },
                                  "courseVersionNumber": {
                                    "type": "integer"
                                  }
                                }
                              },
                              "effective": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "releaseId",
                                  "releaseNumber",
                                  "courseVersionId",
                                  "courseVersionNumber"
                                ],
                                "properties": {
                                  "releaseId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Null only for an origin epoch whose row was never materialized."
                                  },
                                  "releaseNumber": {
                                    "type": "integer"
                                  },
                                  "courseVersionId": {
                                    "type": "string"
                                  },
                                  "courseVersionNumber": {
                                    "type": "integer"
                                  }
                                }
                              },
                              "desired": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "releaseId",
                                  "releaseNumber",
                                  "courseVersionId",
                                  "courseVersionNumber"
                                ],
                                "properties": {
                                  "releaseId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "Null only for an origin epoch whose row was never materialized."
                                  },
                                  "releaseNumber": {
                                    "type": "integer"
                                  },
                                  "courseVersionId": {
                                    "type": "string"
                                  },
                                  "courseVersionNumber": {
                                    "type": "integer"
                                  }
                                }
                              },
                              "effectiveSide": {
                                "type": "string",
                                "enum": [
                                  "SOURCE",
                                  "DESTINATION",
                                  "OTHER"
                                ]
                              }
                            }
                          },
                          "migrations": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "migrationId",
                                "outcome",
                                "reason",
                                "fromRelease",
                                "toRelease",
                                "preflightId",
                                "actorUserId",
                                "at"
                              ],
                              "properties": {
                                "migrationId": {
                                  "type": "string"
                                },
                                "outcome": {
                                  "type": "string",
                                  "enum": [
                                    "APPLIED",
                                    "DEFERRED",
                                    "SKIPPED",
                                    "BLOCKED"
                                  ]
                                },
                                "reason": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "fromRelease": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "additionalProperties": false,
                                  "required": [
                                    "releaseId",
                                    "releaseNumber",
                                    "courseVersionId",
                                    "courseVersionNumber"
                                  ],
                                  "properties": {
                                    "releaseId": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "description": "Null only for an origin epoch whose row was never materialized."
                                    },
                                    "releaseNumber": {
                                      "type": "integer"
                                    },
                                    "courseVersionId": {
                                      "type": "string"
                                    },
                                    "courseVersionNumber": {
                                      "type": "integer"
                                    }
                                  }
                                },
                                "toRelease": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "additionalProperties": false,
                                  "required": [
                                    "releaseId",
                                    "releaseNumber",
                                    "courseVersionId",
                                    "courseVersionNumber"
                                  ],
                                  "properties": {
                                    "releaseId": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "description": "Null only for an origin epoch whose row was never materialized."
                                    },
                                    "releaseNumber": {
                                      "type": "integer"
                                    },
                                    "courseVersionId": {
                                      "type": "string"
                                    },
                                    "courseVersionNumber": {
                                      "type": "integer"
                                    }
                                  }
                                },
                                "preflightId": {
                                  "type": "string"
                                },
                                "actorUserId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "at": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              }
                            },
                            "description": "Decisions touching source→destination, newest first."
                          },
                          "carry": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "releaseId",
                              "releaseNumber",
                              "appliedAt",
                              "policy",
                              "byAction",
                              "byChange",
                              "summary",
                              "lessons"
                            ],
                            "properties": {
                              "releaseId": {
                                "type": "string"
                              },
                              "releaseNumber": {
                                "type": "integer"
                              },
                              "appliedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "policy": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "assessmentReplaced",
                                  "contentChanged",
                                  "openWork",
                                  "completedAssignments"
                                ],
                                "properties": {
                                  "assessmentReplaced": {
                                    "type": "string",
                                    "enum": [
                                      "RESET",
                                      "GRANDFATHER"
                                    ]
                                  },
                                  "contentChanged": {
                                    "type": "string",
                                    "enum": [
                                      "CARRY",
                                      "RESET"
                                    ]
                                  },
                                  "openWork": {
                                    "type": "string",
                                    "enum": [
                                      "DEFER"
                                    ]
                                  },
                                  "completedAssignments": {
                                    "type": "string",
                                    "enum": [
                                      "SKIP"
                                    ]
                                  }
                                }
                              },
                              "byAction": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "CARRY",
                                  "RESET",
                                  "START",
                                  "RETIRE"
                                ],
                                "properties": {
                                  "CARRY": {
                                    "type": "integer"
                                  },
                                  "RESET": {
                                    "type": "integer"
                                  },
                                  "START": {
                                    "type": "integer"
                                  },
                                  "RETIRE": {
                                    "type": "integer"
                                  }
                                }
                              },
                              "byChange": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "UNCHANGED",
                                  "CONTENT_CHANGED",
                                  "ASSESSMENT_REPLACED",
                                  "ASSESSMENT_SETTINGS_CHANGED",
                                  "KIND_CHANGED",
                                  "MOVED",
                                  "ADDED",
                                  "REMOVED"
                                ],
                                "properties": {
                                  "UNCHANGED": {
                                    "type": "integer"
                                  },
                                  "CONTENT_CHANGED": {
                                    "type": "integer"
                                  },
                                  "ASSESSMENT_REPLACED": {
                                    "type": "integer"
                                  },
                                  "ASSESSMENT_SETTINGS_CHANGED": {
                                    "type": "integer"
                                  },
                                  "KIND_CHANGED": {
                                    "type": "integer"
                                  },
                                  "MOVED": {
                                    "type": "integer"
                                  },
                                  "ADDED": {
                                    "type": "integer"
                                  },
                                  "REMOVED": {
                                    "type": "integer"
                                  }
                                }
                              },
                              "summary": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "copied",
                                  "reset",
                                  "started",
                                  "retired",
                                  "assessmentFormChanged",
                                  "attemptPointerKept"
                                ],
                                "properties": {
                                  "copied": {
                                    "type": "integer",
                                    "description": "CARRY — verified status kept."
                                  },
                                  "reset": {
                                    "type": "integer",
                                    "description": "RESET — status returned to NOT_STARTED."
                                  },
                                  "started": {
                                    "type": "integer",
                                    "description": "START — lesson new in the destination."
                                  },
                                  "retired": {
                                    "type": "integer",
                                    "description": "RETIRE — lesson absent from the destination."
                                  },
                                  "assessmentFormChanged": {
                                    "type": "integer"
                                  },
                                  "attemptPointerKept": {
                                    "type": "integer"
                                  }
                                }
                              },
                              "lessons": {
                                "type": [
                                  "array",
                                  "null"
                                ],
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "lessonKey",
                                    "change",
                                    "action",
                                    "sourceStatus",
                                    "destinationStatus",
                                    "assessmentFormChanged",
                                    "attemptPointerKept",
                                    "policyApplied",
                                    "reason"
                                  ],
                                  "properties": {
                                    "lessonKey": {
                                      "type": "string"
                                    },
                                    "change": {
                                      "type": "string",
                                      "enum": [
                                        "UNCHANGED",
                                        "CONTENT_CHANGED",
                                        "ASSESSMENT_REPLACED",
                                        "ASSESSMENT_SETTINGS_CHANGED",
                                        "KIND_CHANGED",
                                        "MOVED",
                                        "ADDED",
                                        "REMOVED"
                                      ]
                                    },
                                    "action": {
                                      "type": "string",
                                      "enum": [
                                        "CARRY",
                                        "RESET",
                                        "START",
                                        "RETIRE"
                                      ]
                                    },
                                    "sourceStatus": {
                                      "type": "string"
                                    },
                                    "destinationStatus": {
                                      "type": "string"
                                    },
                                    "assessmentFormChanged": {
                                      "type": "boolean",
                                      "description": "The destination lesson pins a different assessment form version."
                                    },
                                    "attemptPointerKept": {
                                      "type": "boolean",
                                      "description": "The destination row keeps the source attempt as its latest-attempt pointer (attempts are immutable history; nothing is copied)."
                                    },
                                    "policyApplied": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "dimension",
                                            "value"
                                          ],
                                          "properties": {
                                            "dimension": {
                                              "type": "string",
                                              "enum": [
                                                "assessmentReplaced"
                                              ]
                                            },
                                            "value": {
                                              "type": "string",
                                              "enum": [
                                                "RESET",
                                                "GRANDFATHER"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "dimension",
                                            "value"
                                          ],
                                          "properties": {
                                            "dimension": {
                                              "type": "string",
                                              "enum": [
                                                "contentChanged"
                                              ]
                                            },
                                            "value": {
                                              "type": "string",
                                              "enum": [
                                                "CARRY",
                                                "RESET"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "reason": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "description": "Null unless includeLessons=true."
                              }
                            }
                          },
                          "attempts": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "onSource",
                              "onDestination",
                              "onOther",
                              "carriedPointers",
                              "nativeDestinationPointers",
                              "latest"
                            ],
                            "properties": {
                              "onSource": {
                                "type": "integer",
                                "description": "Submitted attempts pinned to a source-version release."
                              },
                              "onDestination": {
                                "type": "integer",
                                "description": "Submitted attempts pinned to a destination-version release."
                              },
                              "onOther": {
                                "type": "integer"
                              },
                              "carriedPointers": {
                                "type": "integer",
                                "description": "Lesson rows whose latest-attempt pointer is a source-release attempt while the binding is effective on the destination."
                              },
                              "nativeDestinationPointers": {
                                "type": "integer",
                                "description": "Lesson rows whose latest-attempt pointer is a destination-release attempt."
                              },
                              "latest": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "attemptId",
                                  "lessonKey",
                                  "attemptNumber",
                                  "status",
                                  "submittedAt",
                                  "takenOn",
                                  "resultReleasedAt",
                                  "projection"
                                ],
                                "properties": {
                                  "attemptId": {
                                    "type": "string"
                                  },
                                  "lessonKey": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "attemptNumber": {
                                    "type": "integer"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "takenOn": {
                                    "type": "string",
                                    "enum": [
                                      "SOURCE",
                                      "DESTINATION",
                                      "OTHER"
                                    ]
                                  },
                                  "resultReleasedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "projection": {
                                    "type": [
                                      "object",
                                      "null"
                                    ],
                                    "additionalProperties": false,
                                    "required": [
                                      "state",
                                      "earnedPoints",
                                      "possiblePoints",
                                      "passed"
                                    ],
                                    "properties": {
                                      "state": {
                                        "type": "string"
                                      },
                                      "earnedPoints": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ]
                                      },
                                      "possiblePoints": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ]
                                      },
                                      "passed": {
                                        "type": [
                                          "boolean",
                                          "null"
                                        ]
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          },
                          "currentLesson": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "moduleKey",
                              "moduleTitle",
                              "lessonKey",
                              "lessonTitle",
                              "status"
                            ],
                            "properties": {
                              "moduleKey": {
                                "type": "string"
                              },
                              "moduleTitle": {
                                "type": "string"
                              },
                              "lessonKey": {
                                "type": "string"
                              },
                              "lessonTitle": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            }
                          },
                          "lastActivity": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "occurredAt",
                              "lessonKey"
                            ],
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "occurredAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "lessonKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "flags": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "pendingReview",
                              "failedAttempt",
                              "exhaustedRetry",
                              "blockedProgression",
                              "notMigrated"
                            ],
                            "properties": {
                              "pendingReview": {
                                "type": "boolean",
                                "description": "Assignment in the employer court (SUBMITTED / waiting on EMPLOYER) or the latest attempt awaits a manual grade."
                              },
                              "failedAttempt": {
                                "type": "boolean",
                                "description": "Any in-scope lesson row is FAILED."
                              },
                              "exhaustedRetry": {
                                "type": "boolean",
                                "description": "A FAILED assessment lesson whose retry budget is exhausted."
                              },
                              "blockedProgression": {
                                "type": "boolean",
                                "description": "The next lesson in guided order is a required assessment FAILED with no retries left; the course cannot complete without employer action."
                              },
                              "notMigrated": {
                                "type": "boolean",
                                "description": "The binding is not effective on the destination version."
                              }
                            }
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Identical or unpublished version pair (details.lmsCode RELEASE_AUDIT_SAME_VERSION / RELEASE_AUDIT_VERSION_NOT_PUBLISHED), an invalid page size, or a cursor that is not a row of this audit page sequence — unknown or stale (details.lmsCode RELEASE_AUDIT_INVALID_CURSOR; restart from the first page)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, family disabled, or not an employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job, course or version not found (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/review": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsAssignmentReview",
        "summary": "Read the employer grading/review detail for one LMS assignment",
        "description": "`assignmentId` is the enrollment key: a Project To-do assignment id, or `proposal:<jobOfferId>` for an application-stage screening enrollment (the `enrollmentKey` from `GET /lms/jobs/{jobId}/screening`). Requires `lms:read`. The exact assembly behind the web Grade / results surface, including its canonical copyable review URL: submitted responses, current manual grades with notes, effective-grade projections, release state, decision feedback, live retry state, and immutable attempt history. Each lesson carries a `reviewTarget` receipt — the exact immutable attempt tuple (attempt, assessment, course version, release, form version) with a deterministic `targetHash` — ready to pass as `expectedTargetHash` on grade / release-result / decision. Answer keys are never returned.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical employer review projection — authorized responses (including full paragraph prompt + responseText context), grading state, retry state, and immutable attempt history. Answer keys are structurally absent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "review"
                  ],
                  "properties": {
                    "review": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "assignmentId",
                        "assignmentStatus",
                        "waitingOnRole",
                        "submittedAt",
                        "completionPolicy",
                        "returnGrants",
                        "canReturn",
                        "workerName",
                        "courseTitle",
                        "lessons",
                        "links"
                      ],
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "assignmentStatus": {
                          "type": "string"
                        },
                        "waitingOnRole": {
                          "type": "string"
                        },
                        "submittedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "completionPolicy": {
                          "type": "string",
                          "enum": [
                            "SYSTEM",
                            "EMPLOYER_REVIEW"
                          ]
                        },
                        "returnGrants": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "canReturn": {
                          "type": "boolean"
                        },
                        "workerName": {
                          "type": "string"
                        },
                        "courseTitle": {
                          "type": "string"
                        },
                        "lessons": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "lessonKey",
                              "lessonTitle",
                              "status",
                              "reviewReason",
                              "manualReview",
                              "attempt",
                              "reviewTarget",
                              "projection",
                              "retry",
                              "attemptHistory",
                              "responseQuestions"
                            ],
                            "properties": {
                              "lessonKey": {
                                "type": "string"
                              },
                              "lessonTitle": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "reviewReason": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "manualReview": {
                                "type": "boolean"
                              },
                              "attempt": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "number",
                                  "submittedAt",
                                  "formTitle",
                                  "resultReleasedAt"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "formTitle": {
                                    "type": "string"
                                  },
                                  "resultReleasedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  }
                                }
                              },
                              "reviewTarget": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "assignmentId",
                                      "lessonKey",
                                      "attemptId",
                                      "assessmentId",
                                      "courseVersionId",
                                      "releaseId",
                                      "formVersionId",
                                      "targetHash",
                                      "latestAttemptId",
                                      "isLatestAttempt"
                                    ],
                                    "properties": {
                                      "assignmentId": {
                                        "type": "string"
                                      },
                                      "lessonKey": {
                                        "type": "string"
                                      },
                                      "attemptId": {
                                        "type": "string"
                                      },
                                      "assessmentId": {
                                        "type": "string"
                                      },
                                      "courseVersionId": {
                                        "type": "string"
                                      },
                                      "releaseId": {
                                        "type": "string"
                                      },
                                      "formVersionId": {
                                        "type": "string"
                                      },
                                      "targetHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$"
                                      },
                                      "latestAttemptId": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      },
                                      "isLatestAttempt": {
                                        "type": "boolean"
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "projection": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "state",
                                      "earnedPoints",
                                      "possiblePoints",
                                      "passed"
                                    ],
                                    "properties": {
                                      "state": {
                                        "type": "string"
                                      },
                                      "earnedPoints": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "possiblePoints": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "passed": {
                                        "type": [
                                          "boolean",
                                          "null"
                                        ]
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "retry": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "canRetry",
                                      "exhausted",
                                      "attemptCount",
                                      "maxAttempts",
                                      "returnGrants"
                                    ],
                                    "properties": {
                                      "canRetry": {
                                        "type": "boolean"
                                      },
                                      "exhausted": {
                                        "type": "boolean"
                                      },
                                      "attemptCount": {
                                        "type": "integer",
                                        "minimum": 0
                                      },
                                      "maxAttempts": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ],
                                        "minimum": 1
                                      },
                                      "returnGrants": {
                                        "type": "integer",
                                        "minimum": 0
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "attemptHistory": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "id",
                                    "number",
                                    "status",
                                    "submittedAt",
                                    "resultReleasedAt",
                                    "projection"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "status": {
                                      "type": "string"
                                    },
                                    "submittedAt": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "format": "date-time"
                                    },
                                    "resultReleasedAt": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "format": "date-time"
                                    },
                                    "projection": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "state",
                                            "earnedPoints",
                                            "possiblePoints",
                                            "passed"
                                          ],
                                          "properties": {
                                            "state": {
                                              "type": "string"
                                            },
                                            "earnedPoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "possiblePoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "passed": {
                                              "type": [
                                                "boolean",
                                                "null"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  }
                                }
                              },
                              "responseQuestions": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "questionId",
                                    "prompt",
                                    "answer",
                                    "responseText",
                                    "manualMaxPoints",
                                    "grade",
                                    "currentManualGrade"
                                  ],
                                  "properties": {
                                    "questionId": {
                                      "type": "string"
                                    },
                                    "prompt": {
                                      "type": "string"
                                    },
                                    "answer": {
                                      "description": "Immutable raw stored Native Forms answer value (string, number, boolean, string array, or null). Never a correct answer or key."
                                    },
                                    "responseText": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "manualMaxPoints": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "grade": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "correct",
                                            "awardedPoints",
                                            "maxPoints",
                                            "manuallyGraded"
                                          ],
                                          "properties": {
                                            "correct": {
                                              "type": [
                                                "boolean",
                                                "null"
                                              ]
                                            },
                                            "awardedPoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "maxPoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "manuallyGraded": {
                                              "type": "boolean"
                                            }
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "currentManualGrade": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "awardedPoints",
                                            "maxPoints",
                                            "reason"
                                          ],
                                          "properties": {
                                            "awardedPoints": {
                                              "type": "number"
                                            },
                                            "maxPoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "reason": {
                                              "type": [
                                                "string",
                                                "null"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LmsCanonicalLink"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/grades": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "gradeLmsAssessment",
        "summary": "Record per-question manual grades and notes for one attempt",
        "description": "`assignmentId` is the enrollment key: a Project To-do assignment id, or `proposal:<jobOfferId>` for an application-stage screening enrollment (the `enrollmentKey` from `GET /lms/jobs/{jobId}/screening`). Requires `lms:write` and `Idempotency-Key`. Appends question-level manual grades (with optional written notes) to one submitted attempt; the effective grade, lesson progress, and course state update atomically. Attempts carried across course releases grade against their exact historical form version, and the response's `target` receipt reports those immutable pins. Optional `expectedTargetHash` (from the review `reviewTarget`) fences the write: if a worker resubmission moved the lesson's canonical latest attempt, the call fails 409 CONFLICT with `details.lmsCode = 'REVIEW_TARGET_STALE'` and the current canonical target in `details.currentTarget`. The result stays masked from the worker until it is explicitly released.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "lessonKey",
                  "attemptId",
                  "grades"
                ],
                "properties": {
                  "lessonKey": {
                    "type": "string"
                  },
                  "attemptId": {
                    "type": "string"
                  },
                  "expectedTargetHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$",
                    "description": "Optional concurrency fence: the reviewed lesson's `reviewTarget.targetHash`."
                  },
                  "grades": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "required": [
                        "questionId",
                        "awardedPoints"
                      ],
                      "properties": {
                        "questionId": {
                          "type": "string"
                        },
                        "awardedPoints": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 2000
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded grades and the recomputed projection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "grading"
                  ],
                  "properties": {
                    "grading": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "assignmentId",
                        "lessonKey",
                        "attemptId",
                        "replayed",
                        "target",
                        "projection"
                      ],
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "lessonKey": {
                          "type": "string"
                        },
                        "attemptId": {
                          "type": "string"
                        },
                        "replayed": {
                          "type": "boolean"
                        },
                        "target": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "lessonKey",
                            "attemptId",
                            "assessmentId",
                            "courseVersionId",
                            "releaseId",
                            "formVersionId",
                            "targetHash",
                            "latestAttemptId",
                            "isLatestAttempt"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "lessonKey": {
                              "type": "string"
                            },
                            "attemptId": {
                              "type": "string"
                            },
                            "assessmentId": {
                              "type": "string"
                            },
                            "courseVersionId": {
                              "type": "string"
                            },
                            "releaseId": {
                              "type": "string"
                            },
                            "formVersionId": {
                              "type": "string"
                            },
                            "targetHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "latestAttemptId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "isLatestAttempt": {
                              "type": "boolean"
                            }
                          }
                        },
                        "projection": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "earnedPoints",
                            "possiblePoints",
                            "passed",
                            "finalizedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string"
                            },
                            "earnedPoints": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "possiblePoints": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "passed": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            },
                            "finalizedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency, attempt-state, or stale review-target conflict (REVIEW_TARGET_STALE carries the current canonical target)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/release-result": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "releaseLmsResult",
        "summary": "Release one graded assessment result to the worker",
        "description": "`assignmentId` is the enrollment key: a Project To-do assignment id, or `proposal:<jobOfferId>` for an application-stage screening enrollment (the `enrollmentKey` from `GET /lms/jobs/{jobId}/screening`). Requires `lms:write`, `Idempotency-Key`, and explicit `confirmRelease: true`. The release fact is what makes the score, per-question detail, and grading notes visible to the worker; it is blocked while declared manual grades are outstanding. Optional `expectedTargetHash` fences against a concurrent resubmission; a stale target (including an attempt that is no longer the lesson's latest) fails 409 CONFLICT with `details.lmsCode = 'REVIEW_TARGET_STALE'` and the current canonical target attached.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "lessonKey",
                  "attemptId",
                  "confirmRelease"
                ],
                "properties": {
                  "lessonKey": {
                    "type": "string"
                  },
                  "attemptId": {
                    "type": "string"
                  },
                  "confirmRelease": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "expectedTargetHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$",
                    "description": "Optional concurrency fence: the reviewed lesson's `reviewTarget.targetHash`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Release fact",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "release"
                  ],
                  "properties": {
                    "release": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "assignmentId",
                        "lessonKey",
                        "attemptId",
                        "releasedAt",
                        "replayed",
                        "target"
                      ],
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "lessonKey": {
                          "type": "string"
                        },
                        "attemptId": {
                          "type": "string"
                        },
                        "releasedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "replayed": {
                          "type": "boolean"
                        },
                        "target": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "lessonKey",
                            "attemptId",
                            "assessmentId",
                            "courseVersionId",
                            "releaseId",
                            "formVersionId",
                            "targetHash",
                            "latestAttemptId",
                            "isLatestAttempt"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "lessonKey": {
                              "type": "string"
                            },
                            "attemptId": {
                              "type": "string"
                            },
                            "assessmentId": {
                              "type": "string"
                            },
                            "courseVersionId": {
                              "type": "string"
                            },
                            "releaseId": {
                              "type": "string"
                            },
                            "formVersionId": {
                              "type": "string"
                            },
                            "targetHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "latestAttemptId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "isLatestAttempt": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale attempt/review-target or grading-state conflict (REVIEW_TARGET_STALE carries the current canonical target)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/decision": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "decideLmsAssessment",
        "summary": "Record the final pass/fail decision with feedback",
        "description": "`assignmentId` is the enrollment key: a Project To-do assignment id, or `proposal:<jobOfferId>` for an application-stage screening enrollment (the `enrollmentKey` from `GET /lms/jobs/{jobId}/screening`). Requires `lms:write`, `Idempotency-Key`, and explicit `confirmDecision: true`. Records the FINAL employer pass/fail decision for one manual-review lesson with overall feedback the worker sees. Decisions come after the result release and apply to the lesson's canonical latest attempt; optional `expectedTargetHash` pins the attempt actually reviewed — a moved target fails 409 CONFLICT with `details.lmsCode = 'REVIEW_TARGET_STALE'` and the current canonical target attached. FAIL requires a reason.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "lessonKey",
                  "decision",
                  "confirmDecision"
                ],
                "properties": {
                  "lessonKey": {
                    "type": "string"
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "PASS",
                      "FAIL"
                    ]
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "confirmDecision": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "expectedTargetHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$",
                    "description": "Optional fence pinning the attempt actually reviewed: the lesson's `reviewTarget.targetHash`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded decision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "decision"
                  ],
                  "properties": {
                    "decision": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "assignmentId",
                        "lessonKey",
                        "decision",
                        "lessonStatus",
                        "replayed",
                        "target"
                      ],
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "lessonKey": {
                          "type": "string"
                        },
                        "decision": {
                          "type": "string",
                          "enum": [
                            "PASS",
                            "FAIL"
                          ]
                        },
                        "lessonStatus": {
                          "type": "string"
                        },
                        "replayed": {
                          "type": "boolean"
                        },
                        "target": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "assignmentId",
                                "lessonKey",
                                "attemptId",
                                "assessmentId",
                                "courseVersionId",
                                "releaseId",
                                "formVersionId",
                                "targetHash",
                                "latestAttemptId",
                                "isLatestAttempt"
                              ],
                              "properties": {
                                "assignmentId": {
                                  "type": "string"
                                },
                                "lessonKey": {
                                  "type": "string"
                                },
                                "attemptId": {
                                  "type": "string"
                                },
                                "assessmentId": {
                                  "type": "string"
                                },
                                "courseVersionId": {
                                  "type": "string"
                                },
                                "releaseId": {
                                  "type": "string"
                                },
                                "formVersionId": {
                                  "type": "string"
                                },
                                "targetHash": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "latestAttemptId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "isLatestAttempt": {
                                  "type": "boolean"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Ordering, idempotency, or stale review-target conflict (REVIEW_TARGET_STALE carries the current canonical target)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/return": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "returnLmsAssignment",
        "summary": "Plan or apply the canonical assignment RETURN",
        "description": "Requires `lms:write`. With `plan: true`, performs a no-write eligibility check and returns the exact submitted-state guards required for confirmation. With explicit `confirmReturn: true`, requires `Idempotency-Key`, required feedback, and the reviewed `expectedSubmittedAt` plus `expectedStatus`; the server atomically rejects stale state. For an exhausted failed mastery assignment, one applied canonical Project To-do RETURN grants exactly one additional module run. There is no direct attempt-limit mutation or run-limit mutation.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Required only when confirmReturn is true. Omit for the no-write plan request."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "reason"
                ],
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "expectedSubmittedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "expectedStatus": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "plan": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "confirmReturn": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "plan"
                    ],
                    "not": {
                      "required": [
                        "confirmReturn"
                      ]
                    }
                  },
                  {
                    "required": [
                      "confirmReturn",
                      "expectedSubmittedAt",
                      "expectedStatus"
                    ],
                    "not": {
                      "required": [
                        "plan"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return plan or applied outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "returned",
                    "plan",
                    "replayed",
                    "mastery"
                  ],
                  "properties": {
                    "returned": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "status",
                            "reason"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "reason": {
                              "type": "string"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "plan": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "valid",
                            "reason",
                            "expectedSubmittedAt",
                            "expectedStatus",
                            "mastery",
                            "projectedEffectiveRunLimit"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "valid": {
                              "type": "boolean"
                            },
                            "reason": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "mastery": {
                              "oneOf": [
                                {
                                  "$ref": "#/components/schemas/LmsMasteryProjection"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "projectedEffectiveRunLimit": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 1
                            },
                            "expectedSubmittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "expectedStatus": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 40
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "mastery": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/LmsMasteryProjection"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Assignment state is stale or return is not eligible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/remind": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "remindLmsAssignment",
        "summary": "Enqueue an actionable LMS assignment reminder",
        "description": "Requires `lms:write`, `Idempotency-Key`, employer access to jobId, and explicit `confirmReminder: true`. The assignment must still be open and waiting on the worker. Delivery is enqueued and revalidated through the canonical Project To-do notification lifecycle; this endpoint never direct-sends.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jobId",
                  "confirmReminder"
                ],
                "properties": {
                  "jobId": {
                    "type": "string"
                  },
                  "confirmReminder": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reminder enqueue result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Assignment not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Assignment is no longer actionable or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/assignments/{assignmentId}/cancel": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "cancelLmsAssignment",
        "summary": "Cancel an LMS assignment through Project To-dos",
        "description": "Requires `lms:write`, `Idempotency-Key`, employer access to jobId, a non-empty reason, and explicit `confirmCancel: true`. This is the canonical LMS unassignment: it closes the Project To-do envelope, immediately revokes worker course/media access, and preserves immutable course, progress, and event history for audit.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jobId",
                  "reason",
                  "confirmCancel"
                ],
                "properties": {
                  "jobId": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "confirmCancel": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "cancellation"
                  ],
                  "properties": {
                    "cancellation": {
                      "type": "object",
                      "required": [
                        "assignmentId",
                        "jobId",
                        "status",
                        "reason"
                      ],
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "CLOSED"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing reason or explicit confirmation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Assignment is terminal or idempotency key conflicts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/training": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsJobTraining",
        "summary": "Read the Training (LMS) activation status for one job",
        "description": "Requires `lms:read` and employer access to the job. Returns the canonical copyable Job Training URL. Job Settings only enables Training for a job; it never owns a roster — assignment stays exclusively on Project To-dos.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Training status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "training",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "training": {
                      "type": "object",
                      "required": [
                        "jobId",
                        "enabled",
                        "projectTodosEnabled",
                        "links"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "projectTodosEnabled": {
                          "type": "boolean"
                        },
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LmsCanonicalLink"
                          }
                        },
                        "readiness": {
                          "type": "object",
                          "description": "Whether the job’s training courses are visible. ORIGIN_COURSES_NOT_LINKED: courses created with this job as originJobId (provenance only) that have no active link. TRAINING_SETTINGS_OFF: the job has linked or origin training courses while Training or Project To-dos is off. Each warning lists the courseIds and the exact nextCommands that fix it.",
                          "required": [
                            "linkedTrainingCourseIds",
                            "unlinkedOriginCourseIds",
                            "ready",
                            "warnings"
                          ],
                          "properties": {
                            "linkedTrainingCourseIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "unlinkedOriginCourseIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "ready": {
                              "type": "boolean"
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "code",
                                  "message",
                                  "courseIds",
                                  "nextCommands"
                                ],
                                "properties": {
                                  "code": {
                                    "type": "string",
                                    "enum": [
                                      "ORIGIN_COURSES_NOT_LINKED",
                                      "TRAINING_SETTINGS_OFF"
                                    ]
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "courseIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "nextCommands": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "setLmsJobTraining",
        "summary": "Enable or disable Training (LMS) for one job",
        "description": "Requires `lms:write`, `Idempotency-Key`, employer access to the job, and explicit `confirmTraining: true` (agent acknowledgement of a live shared-state change). Enabling invites nobody and disabling deletes nothing: the toggle only configures the job Training surface, and assignment/unassignment stays exclusively on Project To-dos. Retrying the same key with the same payload replays the stored receipt; reusing the key with a changed payload is a 409.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "enabled",
                  "confirmTraining"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "confirmTraining": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Training toggle receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "training",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "training": {
                      "type": "object",
                      "required": [
                        "jobId",
                        "enabled",
                        "changed"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "changed": {
                          "type": "boolean"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency key reused with a different payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/screening": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsJobScreening",
        "summary": "Read one job’s screening course and every proposal’s enrollment state",
        "description": "Requires `lms:read` and employer access to the job. Application-stage screening: the job’s ACTIVE screening link (course, attempt ceiling, current published version) and every proposal on the job, newest first, with its derived enrollment status (`OPEN` | `IN_PROGRESS` | `SUBMITTED`), whose move it is (`WORKER` | `EMPLOYER` | `NONE`), the effective course version the applicant is enrolled on and whether that is the link’s current version, plus two counts for the review/rank flow: `bindingGaps` (proposals with no enrollment — backfill with `POST /lms/jobs/{jobId}/screening/assign`) and `staleVersionCount` (enrollments on an older course version than the link’s current one, so scores are not directly comparable). Each enrolled proposal carries `enrollmentKey` = `proposal:<jobOfferId>`, accepted as the `assignmentId` of the review, grades, release-result and decision operations. Bounded by `limit` (default and maximum 500) with `hasMore`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job screening status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "screening",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "screening": {
                      "type": "object",
                      "required": [
                        "jobId",
                        "link",
                        "proposals",
                        "bindingGaps",
                        "staleVersionCount",
                        "hasMore"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "link": {
                          "type": "object",
                          "nullable": true,
                          "required": [
                            "id",
                            "courseId",
                            "courseTitle",
                            "maxAttempts",
                            "currentVersion"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "courseId": {
                              "type": "string"
                            },
                            "courseTitle": {
                              "type": "string"
                            },
                            "maxAttempts": {
                              "type": "integer"
                            },
                            "currentVersion": {
                              "type": "object",
                              "nullable": true,
                              "required": [
                                "id",
                                "versionNumber",
                                "contentHash"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "versionNumber": {
                                  "type": "integer"
                                },
                                "contentHash": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        },
                        "proposals": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "jobOfferId",
                              "applicantName",
                              "offerStatus",
                              "proposalCreatedAt",
                              "enrollmentKey",
                              "binding"
                            ],
                            "properties": {
                              "jobOfferId": {
                                "type": "string"
                              },
                              "applicantName": {
                                "type": "string",
                                "nullable": true
                              },
                              "offerStatus": {
                                "type": "string",
                                "nullable": true
                              },
                              "proposalCreatedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "enrollmentKey": {
                                "type": "string",
                                "nullable": true
                              },
                              "binding": {
                                "type": "object",
                                "nullable": true,
                                "required": [
                                  "id",
                                  "status",
                                  "waitingOn",
                                  "courseVersionId",
                                  "courseVersionNumber",
                                  "courseVersionCurrent",
                                  "createdAt"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "OPEN",
                                      "IN_PROGRESS",
                                      "SUBMITTED"
                                    ]
                                  },
                                  "waitingOn": {
                                    "type": "string",
                                    "enum": [
                                      "WORKER",
                                      "EMPLOYER",
                                      "NONE"
                                    ]
                                  },
                                  "courseVersionId": {
                                    "type": "string"
                                  },
                                  "courseVersionNumber": {
                                    "type": "integer",
                                    "nullable": true
                                  },
                                  "courseVersionCurrent": {
                                    "type": "boolean"
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "bindingGaps": {
                          "type": "integer"
                        },
                        "staleVersionCount": {
                          "type": "integer"
                        },
                        "hasMore": {
                          "type": "boolean"
                        }
                      }
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/question-results": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsQuestionResults",
        "summary": "Read per-question quiz results for one job",
        "description": "Requires `lms:read` and employer access to the job. Per-question results for the LMS quizzes of the job, counted from the FIRST submitted attempt of each person at each quiz version (remediation attempts from employer review cycles are excluded, and later mastery runs never count as skips). Results are grouped by course, lesson and quiz version. For every question: how many people got it right, wrong or partly right, skipped it, or are awaiting a manual grade; for choice questions, how many picked each choice with the correct choice marked; and who missed it, with their answer. Names are always masked as \"First L.\" and email is never included. Hired workers (`audience=HIRED`, default) and applicants (`audience=APPLICANT`, application-stage screening) are separate audiences. Optional `courseId` narrows to one course. Bounded at 5000 attempts; `truncated` is true when the cap was reached (the oldest attempts are kept).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "audience",
            "in": "query",
            "required": false,
            "description": "HIRED (default) for hired workers, APPLICANT for screening applicants.",
            "schema": {
              "type": "string",
              "enum": [
                "HIRED",
                "APPLICANT"
              ],
              "default": "HIRED"
            }
          },
          {
            "name": "courseId",
            "in": "query",
            "required": false,
            "description": "Only count quizzes from this course.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-question quiz results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "questionResults",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "questionResults": {
                      "$ref": "#/components/schemas/LmsQuestionResults"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid audience or courseId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/screening/assign": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "assignLmsScreening",
        "summary": "Backfill one proposal’s screening enrollment",
        "description": "Requires `lms:write`, `Idempotency-Key`, employer access to the job, and explicit `confirmAssign: true`. Creates the screening binding for one proposal on a screening-linked job — the repair for `bindingGaps` (proposals that predate the link, or whose fail-soft enrollment at submit did not land). The binding is identical to one created at submit and anchors the applicant on the link’s current published version. Idempotent per proposal (`created: false` when it already existed); retrying the same key replays the receipt. Typed refusals: 409 `SCREENING_NOT_CONFIGURED` (no ACTIVE screening link), 409 `SCREENING_COURSE_UNPUBLISHED`, 400 `SCREENING_BINDING_INVALID` (the proposal is not on this job, or is an invite rather than a proposal).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jobOfferId",
                  "confirmAssign"
                ],
                "properties": {
                  "jobOfferId": {
                    "type": "string"
                  },
                  "confirmAssign": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Screening enrollment receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "assignment",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "assignment": {
                      "type": "object",
                      "required": [
                        "jobId",
                        "jobOfferId",
                        "bindingId",
                        "enrollmentKey",
                        "created"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "jobOfferId": {
                          "type": "string"
                        },
                        "bindingId": {
                          "type": "string"
                        },
                        "enrollmentKey": {
                          "type": "string"
                        },
                        "created": {
                          "type": "boolean"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid proposal for this job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "No ACTIVE screening link, unpublished course, or idempotency key reused with a different payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/courses": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsJobCourses",
        "summary": "List the LMS courses linked to one job",
        "description": "Requires `lms:read` and employer access to the job. Returns active course links with each course title, current published version, and authorized canonical human-navigation URLs; internal link bookkeeping is never exposed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Linked courses",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "links",
                    "courses",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsCanonicalLink"
                      }
                    },
                    "courses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "links": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/LmsCanonicalLink"
                            }
                          }
                        }
                      }
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/courses/link": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "linkLmsJobCourse",
        "summary": "Link an LMS course to one job",
        "description": "Requires `lms:write`, `Idempotency-Key`, employer access to the job, an organization-owned non-archived course (draft or published — no publish prerequisite), and explicit `confirmLink: true` (agent acknowledgement of a live shared-state change). `stage` selects what the link serves. `TRAINING` (the default for a new link; omitting `stage` when the course is already actively linked keeps that link as it is, so a SCREENING link is never demoted) only associates the course with the job: it publishes nothing and assigns nobody — assignment stays a separate Project To-do step that requires an exact PUBLISHED course version. A `TRAINING` link also turns on the Training and Project To-dos settings for the job when they are off (Project To-dos only when the token also has `project_todos:write`), so the course is immediately assignable; `jobSettingsEnabled` in the response says which ones this call turned on (both false for SCREENING links and replays). `SCREENING` is the application stage: linking assigns nobody retroactively either, but from then on every NEW proposal on the job gets a course binding automatically (applicants take the course and quiz before hire); it requires a PUBLISHED current version at link time and does not require the job Training toggle. At most one ACTIVE screening link per job. `screeningMaxAttempts` (SCREENING only, default 1) caps quiz attempts per applicant. Linking publishes nothing. Duplicate link requests for the same course/job pair converge idempotently; the stage and ceiling are part of the receipt payload, so a retry that changes them under the same key is a 409.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "courseId",
                  "confirmLink"
                ],
                "properties": {
                  "courseId": {
                    "type": "string"
                  },
                  "confirmLink": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  },
                  "stage": {
                    "type": "string",
                    "enum": [
                      "TRAINING",
                      "SCREENING"
                    ]
                  },
                  "screeningMaxAttempts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "nullable": true,
                    "description": "SCREENING only. Quiz attempt ceiling per applicant; omitted = 1."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Course link receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "link",
                    "replayed"
                  ],
                  "properties": {
                    "link": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "jobSettingsEnabled": {
                      "type": "object",
                      "description": "Which job settings this call turned on. A TRAINING link turns on Training and Project To-dos when they are off; SCREENING links and replays report false.",
                      "required": [
                        "training",
                        "projectTodos"
                      ],
                      "properties": {
                        "training": {
                          "type": "boolean"
                        },
                        "projectTodos": {
                          "type": "boolean"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or course not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Course is archived or idempotency key conflicts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/jobs/{jobId}/courses/unlink": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "unlinkLmsJobCourse",
        "summary": "Unlink an LMS course from one job, preserving link history",
        "description": "Requires `lms:write`, `Idempotency-Key`, employer access to the job, and explicit `confirmUnlink: true` (agent acknowledgement of a live shared-state change). Unlinking retires the link while preserving its history for audit — nothing is deleted, and existing assignments keep their immutable course, progress, and event history. Repeating an unlink converges without another write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "courseId",
                  "confirmUnlink"
                ],
                "properties": {
                  "courseId": {
                    "type": "string"
                  },
                  "confirmUnlink": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Course unlink receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "link",
                    "replayed"
                  ],
                  "properties": {
                    "link": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, surface, organization, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or link not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency key reused with a different payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "createLmsPreviewSession",
        "summary": "Create an expiring worker-equivalent Preview session",
        "description": "Requires `lms:write` and `Idempotency-Key`. Pins exactly one authorized course draft revision or immutable published version and uses the real worker renderer and Native Forms controls. When masteryMode/completionPolicy are omitted, Preview derives them from the persisted authoringIntent (legacy trees default STANDARD/SYSTEM). A mastery Preview may omit moduleKey only when exactly one module is eligible; ambiguity fails closed. Preview state is isolated from assignments, attempts, Project To-dos, notifications, reporting, and completion events.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "courseId"
                ],
                "properties": {
                  "courseId": {
                    "type": "string"
                  },
                  "draftRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "publishedVersionId": {
                    "type": "string"
                  },
                  "moduleKey": {
                    "type": "string"
                  },
                  "lessonKey": {
                    "type": "string"
                  },
                  "itemId": {
                    "type": "string"
                  },
                  "masteryMode": {
                    "type": "boolean"
                  },
                  "completionPolicy": {
                    "type": "string",
                    "enum": [
                      "SYSTEM",
                      "EMPLOYER_REVIEW"
                    ]
                  },
                  "masteryRunLimit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10,
                    "default": 3
                  },
                  "masteryAntiGuessPolicy": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "schemaVersion",
                      "cooldownStepsSeconds",
                      "restartScope"
                    ],
                    "properties": {
                      "schemaVersion": {
                        "type": "integer",
                        "enum": [
                          1
                        ]
                      },
                      "cooldownStepsSeconds": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 10,
                        "items": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 3600
                        }
                      },
                      "restartScope": {
                        "type": "string",
                        "enum": [
                          "WHOLE_MODULE",
                          "MISSED_QUESTIONS"
                        ]
                      }
                    }
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "draftRevision"
                    ],
                    "not": {
                      "required": [
                        "publishedVersionId"
                      ]
                    }
                  },
                  {
                    "required": [
                      "publishedVersionId"
                    ],
                    "not": {
                      "required": [
                        "draftRevision"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created Preview session and one-time renderer link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/LmsPreviewSession"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Source revision, session ceiling, or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsPreviewSession",
        "summary": "Inspect one Preview session and pre-submit readiness",
        "description": "Requires `lms:read` and ownership by the caller organization. Returns the pinned source, effective completion policy and authoring-intent source, optimistic state revision, selected location, capture metadata, and unanswered/answered counts. It never discloses correctness or answer keys.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session",
                    "readiness",
                    "run",
                    "review"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/LmsPreviewSession"
                    },
                    "review": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentStatus",
                            "completionPolicy",
                            "returnEventCount",
                            "latestReturn",
                            "lessons"
                          ],
                          "properties": {
                            "assignmentStatus": {
                              "type": "string",
                              "enum": [
                                "OPEN",
                                "IN_PROGRESS",
                                "RETURNED",
                                "SUBMITTED",
                                "COMPLETED"
                              ]
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "SYSTEM",
                                "EMPLOYER_REVIEW"
                              ]
                            },
                            "returnEventCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "latestReturn": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "reason",
                                    "returnedAt"
                                  ],
                                  "properties": {
                                    "reason": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "returnedAt": {
                                      "type": "string",
                                      "format": "date-time"
                                    }
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lessons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "status",
                                  "reviewed",
                                  "reviewReason",
                                  "latestAttempt"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "reviewed": {
                                    "type": "boolean"
                                  },
                                  "reviewReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "latestAttempt": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "attemptNumber",
                                          "status",
                                          "submittedAt",
                                          "grading"
                                        ],
                                        "properties": {
                                          "attemptNumber": {
                                            "type": "integer",
                                            "minimum": 1
                                          },
                                          "status": {
                                            "type": "string",
                                            "enum": [
                                              "IN_PROGRESS",
                                              "SUBMITTED"
                                            ]
                                          },
                                          "submittedAt": {
                                            "type": [
                                              "string",
                                              "null"
                                            ],
                                            "format": "date-time"
                                          },
                                          "grading": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "required": [
                                                  "state",
                                                  "earnedPoints",
                                                  "possiblePoints",
                                                  "passed",
                                                  "pendingManualQuestionIds",
                                                  "resultReleased",
                                                  "resultReleaseMode",
                                                  "canRetry",
                                                  "exhausted"
                                                ],
                                                "properties": {
                                                  "state": {
                                                    "type": "string",
                                                    "enum": [
                                                      "AWAITING_MANUAL_GRADE",
                                                      "FINALIZED"
                                                    ]
                                                  },
                                                  "earnedPoints": {
                                                    "type": "number"
                                                  },
                                                  "possiblePoints": {
                                                    "type": "number"
                                                  },
                                                  "passed": {
                                                    "type": [
                                                      "boolean",
                                                      "null"
                                                    ]
                                                  },
                                                  "pendingManualQuestionIds": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  "resultReleased": {
                                                    "type": "boolean"
                                                  },
                                                  "resultReleaseMode": {
                                                    "type": "string",
                                                    "enum": [
                                                      "IMMEDIATE",
                                                      "MANUAL"
                                                    ]
                                                  },
                                                  "canRetry": {
                                                    "type": "boolean"
                                                  },
                                                  "exhausted": {
                                                    "type": "boolean"
                                                  }
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "readiness": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "unansweredRequiredCount",
                            "answeredCount"
                          ],
                          "properties": {
                            "unansweredRequiredCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "answeredCount": {
                              "type": "integer",
                              "minimum": 0
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "run": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "runNumber",
                            "status",
                            "wrongCount",
                            "unansweredCount",
                            "lessons",
                            "runsRemaining",
                            "exhausted",
                            "antiGuessPolicy",
                            "retryAvailableAt"
                          ],
                          "properties": {
                            "runNumber": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "IN_PROGRESS",
                                "PASSED",
                                "FAILED"
                              ]
                            },
                            "wrongCount": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 0
                            },
                            "unansweredCount": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 0
                            },
                            "lessons": {
                              "oneOf": [
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "lessonKey",
                                      "status",
                                      "redoQuestionIds",
                                      "lockedQuestionIds"
                                    ],
                                    "properties": {
                                      "lessonKey": {
                                        "type": "string"
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "PASSED",
                                          "FAILED"
                                        ]
                                      },
                                      "redoQuestionIds": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      },
                                      "lockedQuestionIds": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "runsRemaining": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "exhausted": {
                              "type": "boolean"
                            },
                            "antiGuessPolicy": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "schemaVersion",
                                    "cooldownStepsSeconds",
                                    "restartScope"
                                  ],
                                  "properties": {
                                    "schemaVersion": {
                                      "type": "integer",
                                      "enum": [
                                        1
                                      ]
                                    },
                                    "cooldownStepsSeconds": {
                                      "type": "array",
                                      "minItems": 1,
                                      "maxItems": 10,
                                      "items": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 3600
                                      }
                                    },
                                    "restartScope": {
                                      "type": "string",
                                      "enum": [
                                        "WHOLE_MODULE",
                                        "MISSED_QUESTIONS"
                                      ]
                                    }
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "retryAvailableAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Preview session not found, expired, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/manage": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "manageLmsPreviewSession",
        "summary": "Navigate, answer, submit, simulate employer review, select the renderer view, reset, expire, or mint a link",
        "description": "Requires `lms:write` and `Idempotency-Key`. State mutations are fenced by expectedStateRevision. `mint_link` returns a refreshable one-time fragment-secret link to the real worker renderer; `select` may navigate freely even when real worker progression is guided. Standard sessions also simulate the assignment lifecycle (DEV-2757): `submit_assessment` grades a lesson through the same pure grader as the employer preview (answering a submitted lesson opens the next attempt within the attempt policy plus one per return); `grade_manual`, `release_result` and `review_lesson` act on the lesson's latest submitted attempt; `approve`, `return` (reason required) and `resubmit` move the simulated course. `review` reports the resulting employer-side state with aggregate grades and question ids only. `select_view` (view required; nothing else accepted) chooses the frame the hosted renderer shows — `WORKER` (the worker player, the default) or `EMPLOYER_REVIEW` (the simulated employer-review panel over the session's simulated attempts: review queue, grading, release and course review, read-only, from the same facts `review` reports — never answer keys, never worker identity); mastery sessions refuse it (409 `MASTERY_REVIEW_BLOCKED`) and observe links always show the worker frame. This operation writes only Preview state: never assignments, Forms attempts, progress, notifications or events.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "action",
                  "expectedStateRevision"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "select",
                      "set_answers",
                      "reset",
                      "expire",
                      "mint_link",
                      "submit_assessment",
                      "grade_manual",
                      "release_result",
                      "review_lesson",
                      "approve",
                      "return",
                      "resubmit",
                      "select_view"
                    ]
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "moduleKey": {
                    "type": "string"
                  },
                  "lessonKey": {
                    "type": "string"
                  },
                  "itemId": {
                    "type": "string"
                  },
                  "view": {
                    "type": "string",
                    "enum": [
                      "WORKER",
                      "EMPLOYER_REVIEW"
                    ],
                    "description": "select_view only (and required there): the frame the hosted renderer shows next. Selecting a view bumps stateRevision like every other write, so a capture token always binds the view it captured."
                  },
                  "answers": {
                    "type": "object",
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "manualGrades": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 200,
                    "description": "grade_manual only: one grade per declared manual question.",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "questionId",
                        "awardedPoints"
                      ],
                      "properties": {
                        "questionId": {
                          "type": "string"
                        },
                        "awardedPoints": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000000
                        }
                      }
                    }
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "PASS",
                      "FAIL"
                    ],
                    "description": "review_lesson only."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000,
                    "description": "Required by return and by review_lesson FAIL."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated Preview session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session",
                    "review"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/LmsPreviewSession"
                    },
                    "review": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentStatus",
                            "completionPolicy",
                            "returnEventCount",
                            "latestReturn",
                            "lessons"
                          ],
                          "properties": {
                            "assignmentStatus": {
                              "type": "string",
                              "enum": [
                                "OPEN",
                                "IN_PROGRESS",
                                "RETURNED",
                                "SUBMITTED",
                                "COMPLETED"
                              ]
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "SYSTEM",
                                "EMPLOYER_REVIEW"
                              ]
                            },
                            "returnEventCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "latestReturn": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "reason",
                                    "returnedAt"
                                  ],
                                  "properties": {
                                    "reason": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "returnedAt": {
                                      "type": "string",
                                      "format": "date-time"
                                    }
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lessons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "status",
                                  "reviewed",
                                  "reviewReason",
                                  "latestAttempt"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "reviewed": {
                                    "type": "boolean"
                                  },
                                  "reviewReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "latestAttempt": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "attemptNumber",
                                          "status",
                                          "submittedAt",
                                          "grading"
                                        ],
                                        "properties": {
                                          "attemptNumber": {
                                            "type": "integer",
                                            "minimum": 1
                                          },
                                          "status": {
                                            "type": "string",
                                            "enum": [
                                              "IN_PROGRESS",
                                              "SUBMITTED"
                                            ]
                                          },
                                          "submittedAt": {
                                            "type": [
                                              "string",
                                              "null"
                                            ],
                                            "format": "date-time"
                                          },
                                          "grading": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "required": [
                                                  "state",
                                                  "earnedPoints",
                                                  "possiblePoints",
                                                  "passed",
                                                  "pendingManualQuestionIds",
                                                  "resultReleased",
                                                  "resultReleaseMode",
                                                  "canRetry",
                                                  "exhausted"
                                                ],
                                                "properties": {
                                                  "state": {
                                                    "type": "string",
                                                    "enum": [
                                                      "AWAITING_MANUAL_GRADE",
                                                      "FINALIZED"
                                                    ]
                                                  },
                                                  "earnedPoints": {
                                                    "type": "number"
                                                  },
                                                  "possiblePoints": {
                                                    "type": "number"
                                                  },
                                                  "passed": {
                                                    "type": [
                                                      "boolean",
                                                      "null"
                                                    ]
                                                  },
                                                  "pendingManualQuestionIds": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  "resultReleased": {
                                                    "type": "boolean"
                                                  },
                                                  "resultReleaseMode": {
                                                    "type": "string",
                                                    "enum": [
                                                      "IMMEDIATE",
                                                      "MANUAL"
                                                    ]
                                                  },
                                                  "canRetry": {
                                                    "type": "boolean"
                                                  },
                                                  "exhausted": {
                                                    "type": "boolean"
                                                  }
                                                }
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Stale Preview state revision or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/runs": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "submitLmsPreviewRun",
        "summary": "Submit or restart one simulated mastery run",
        "description": "Requires `lms:write`, `Idempotency-Key`, and expectedStateRevision. Uses the canonical mastery grading and carry/lock/redo rules but persists only isolated Preview state. Result markers contain IDs, aggregate counts, and redo/locked question IDs; they never contain answer keys, correct values, prior wrong values, or per-question scores.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "action",
                  "expectedStateRevision"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "submit",
                      "restart",
                      "advance_cooldown"
                    ]
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Simulated mastery run result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session",
                    "run"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/LmsPreviewSession"
                    },
                    "run": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "runNumber",
                            "status",
                            "wrongCount",
                            "unansweredCount",
                            "lessons"
                          ],
                          "properties": {
                            "runNumber": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "IN_PROGRESS",
                                "PASSED",
                                "FAILED"
                              ]
                            },
                            "wrongCount": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 0
                            },
                            "unansweredCount": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 0
                            },
                            "lessons": {
                              "type": [
                                "array",
                                "null"
                              ],
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "redoQuestionIds",
                                  "lockedQuestionIds"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "redoQuestionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "lockedQuestionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Stale Preview state revision, invalid run transition, or retry conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/artifacts": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "prepareLmsPreviewArtifact",
        "summary": "Prepare a private Preview screenshot upload",
        "description": "Requires `lms:write` and `Idempotency-Key`. Creates a session- and render-revision-bound PENDING artifact and a short-lived signed PUT (outcome PENDING_UPLOAD). Same-key replay on a verified capture returns outcome ALREADY_READY with `upload: null` — a fresh upsert URL is NEVER minted against verified bytes, so callers must branch on `outcome` (or `upload === null`) before uploading. A same-key retry of a FAILED artifact re-arms it to PENDING with a cleared failure and a fresh pending window. The upload is PNG-only and does not mutate course or worker state.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "viewport",
                  "expectedStateRevision"
                ],
                "properties": {
                  "viewport": {
                    "type": "string",
                    "enum": [
                      "desktop",
                      "mobile"
                    ]
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "moduleKey": {
                    "type": "string"
                  },
                  "lessonKey": {
                    "type": "string"
                  },
                  "itemId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Prepared screenshot upload (or verified-READY recovery readback)",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "ok",
                        "outcome",
                        "artifact",
                        "upload"
                      ],
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "outcome": {
                          "type": "string",
                          "enum": [
                            "PENDING_UPLOAD"
                          ]
                        },
                        "artifact": {
                          "$ref": "#/components/schemas/LmsPreviewArtifact"
                        },
                        "upload": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "url",
                            "method",
                            "headers",
                            "expiresAt"
                          ],
                          "properties": {
                            "url": {
                              "type": "string",
                              "format": "uri"
                            },
                            "method": {
                              "type": "string",
                              "enum": [
                                "PUT"
                              ]
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "ok",
                        "outcome",
                        "artifact",
                        "upload"
                      ],
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "outcome": {
                          "type": "string",
                          "enum": [
                            "ALREADY_READY"
                          ]
                        },
                        "artifact": {
                          "$ref": "#/components/schemas/LmsPreviewArtifact"
                        },
                        "upload": {
                          "type": "null"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsPreviewArtifacts",
        "summary": "List private Preview screenshot artifacts",
        "description": "Requires `lms:read` and organization ownership of the session. Returns a bounded page of artifact metadata and short-lived URLs only for READY artifacts.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paged Preview artifacts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "sessionId",
                    "artifacts",
                    "nextCursor"
                  ],
                  "properties": {
                    "sessionId": {
                      "type": "string"
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsPreviewArtifact"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/artifacts/{artifactId}/finalize": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "finalizeLmsPreviewArtifact",
        "summary": "Finalize and integrity-check a Preview screenshot",
        "description": "Requires `lms:write` and `Idempotency-Key`. A closed two-branch union: the READY branch (default) verifies that the private uploaded object is a PNG with the declared SHA-256 checksum and byte size before CAS-marking it READY from PENDING; the FAILED branch reports a typed capture failure (closed code + bounded diagnostic; checksum/byteSize structurally absent) so no artifact stays silently pending. Replays converge only on an IDENTICAL outcome — a repeated FAILED with a different code/detail is 409 FAILURE_MISMATCH, a concurrent READY winner is 409 ALREADY_READY, and any other race is 409 FINALIZE_CONFLICT. A FAILED artifact re-arms only through a same-key prepare retry.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "checksumSha256",
                      "byteSize"
                    ],
                    "properties": {
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "READY"
                        ]
                      },
                      "checksumSha256": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "byteSize": {
                        "type": "integer",
                        "minimum": 1
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "outcome",
                      "failureCode"
                    ],
                    "properties": {
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "FAILED"
                        ]
                      },
                      "failureCode": {
                        "type": "string",
                        "enum": [
                          "RENDERER_UNREACHABLE",
                          "RENDERER_AUTH_REQUIRED",
                          "READY_MARKER_TIMEOUT",
                          "CAPTURE_TIMEOUT",
                          "CAPTURE_CRASH",
                          "UPLOAD_INCOMPLETE"
                        ]
                      },
                      "failureDetail": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Finalized Preview artifact (READY or durably typed FAILED)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "artifact"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "artifact": {
                      "$ref": "#/components/schemas/LmsPreviewArtifact"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Artifact bytes, checksum, render revision, idempotency, failure-mismatch, or finalize-race conflict. Non-PNG hosted kinds (including READY PDF/HTML replays) refuse with HOSTED_ARTIFACT_FINALIZE_ONLY; only renderer orchestration may finalize them.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/artifacts/{artifactId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsPreviewArtifact",
        "summary": "Read one Preview artifact and its short-lived signed URL",
        "description": "Requires `lms:read` and organization ownership of the artifact. Returns the canonical `url` field only when the artifact is READY and unexpired; storage credentials and storage paths are never exposed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview artifact",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "artifact"
                  ],
                  "properties": {
                    "artifact": {
                      "$ref": "#/components/schemas/LmsPreviewArtifact"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Artifact not found, expired, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/audit": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsPreviewAuditPlan",
        "summary": "Plan a canonical full-course worker-render audit",
        "description": "Requires `lms:read`. Returns an immutable, canonical-order target plan over the exact draft revision or published version pinned by the synthetic Preview session. Normal sessions include every lesson; mastery sessions remain constrained to their pinned module. This planning call creates no assignments, Project To-dos, Native Forms attempts, learner progress, or notifications.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full-course visual-audit plan",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "sessionId",
                    "courseId",
                    "sourceDigest",
                    "source",
                    "stateRevision",
                    "targetCount",
                    "targets",
                    "zeroWriteScope"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "courseId": {
                      "type": "string"
                    },
                    "sourceDigest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "source": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "draftRevision"
                          ],
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "draft"
                              ]
                            },
                            "draftRevision": {
                              "type": "integer",
                              "minimum": 0
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "publishedVersionId"
                          ],
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "version"
                              ]
                            },
                            "publishedVersionId": {
                              "type": "string"
                            }
                          }
                        }
                      ]
                    },
                    "stateRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "targetCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "targets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsPreviewAuditTarget"
                      }
                    },
                    "zeroWriteScope": {
                      "type": "array",
                      "minItems": 5,
                      "maxItems": 5,
                      "items": {
                        "type": "string",
                        "enum": [
                          "assignments",
                          "projectTodos",
                          "nativeFormAttempts",
                          "learnerProgress",
                          "notifications"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/audit/capture": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "captureLmsPreviewAuditTarget",
        "summary": "Capture one resumable target in a full-course worker-render audit",
        "description": "Requires `lms:write` and `Idempotency-Key`. Resets only the synthetic Preview simulation, selects one source-digest-fenced target, applies any DERIVED state transitions server-side (incorrect-feedback/passed submissions and mastery failed/carry-lock-redo/passed runs, driven through the canonical graders with server-derived answers — keys never cross the wire), and renders it through the real hosted worker player. Derived transitions are receipt-bound under stable per-target child keys, so a retried capture replays the ORIGINAL revision and proof instead of double-applying. A verdict that cannot prove the requested label fails 409 AUDIT_STATE_UNPROVABLE with a typed cause. The caller repeats this bounded operation until `complete` is true.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "targetIndex",
                  "expectedSourceDigest",
                  "expectedStateRevision"
                ],
                "properties": {
                  "targetIndex": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 499
                  },
                  "expectedSourceDigest": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "viewports": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "desktop",
                        "mobile"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 2,
                    "uniqueItems": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Captured full-course audit target",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "sessionId",
                    "sourceDigest",
                    "target",
                    "targetCount",
                    "nextTargetIndex",
                    "complete",
                    "selectionApplied",
                    "stateRevision",
                    "stateProof",
                    "render"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "sourceDigest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "target": {
                      "$ref": "#/components/schemas/LmsPreviewAuditTarget"
                    },
                    "targetCount": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "nextTargetIndex": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    },
                    "complete": {
                      "type": "boolean"
                    },
                    "selectionApplied": {
                      "type": "boolean"
                    },
                    "stateRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "stateProof": {
                      "description": "Worker-safe verification that the derived target state held at capture time; null for CONTENT/ASSESSMENT_UNANSWERED targets. Never carries answer keys or per-question correct values.",
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "lessonStatus",
                            "run"
                          ],
                          "properties": {
                            "lessonStatus": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "run": {
                              "oneOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "runNumber",
                                    "status",
                                    "wrongCount",
                                    "unansweredCount",
                                    "redoQuestionCount"
                                  ],
                                  "properties": {
                                    "runNumber": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "status": {
                                      "type": "string"
                                    },
                                    "wrongCount": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0
                                    },
                                    "unansweredCount": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0
                                    },
                                    "redoQuestionCount": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        }
                      ]
                    },
                    "render": {
                      "$ref": "#/components/schemas/LmsPreviewRenderResponse"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Source-digest, state-revision, target, or capture conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Renderer service unavailable or at capacity (retryable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/render": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "renderLmsPreviewHosted",
        "summary": "Hosted-render the real worker player or the simulated employer-review panel (server-driven Chromium)",
        "description": "Requires `lms:write` and `Idempotency-Key`. Renders the session’s CURRENT focus in the hosted pinned-Chromium renderer into desktop/mobile PNG captures plus ARIA snapshot, diagnostics, and a provenance manifest (evidence class SIMULATED_WORKER_PREVIEW). Optional target fields ASSERT the current focus — they never navigate; use `manage {action:\"select\"}` first. The frame captured is the session’s current `rendererView` (DEV-2757): the worker player, or — after `manage {action:\"select_view\", view:\"EMPLOYER_REVIEW\"}` on a standard session — the read-only simulated employer-review panel (review queue, grading, release and course review over the session’s simulated attempts; aggregate grades and pinned manual-question prompts only, never answer keys or worker identity). `view` ASSERTS that frame the same way (400 on mismatch) and the manifest’s `target.view` records it; document captures are worker-view only. Fenced by `expectedStateRevision` with a post-capture readback fence; evidence becomes READY atomically or not at all. Writes only preview control/evidence rows — zero learner/domain writes. Fails 503 (retryable) while the renderer service is unavailable or at capacity.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedStateRevision"
                ],
                "properties": {
                  "documentFormats": {
                    "$schema": "http://json-schema.org/draft-07/schema#",
                    "minItems": 1,
                    "maxItems": 2,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "PDF",
                        "HTML"
                      ]
                    },
                    "uniqueItems": true,
                    "description": "Opt in to complete unanswered worker-view PDF/HTML (static raster pages; ARIA provides semantics). Fixed print viewport; omit viewports and clear item/question focus. At most 40 pages/200 units; no truncation. Live media or incomplete source returns DOCUMENT_INCOMPLETE; oversized documents return DOCUMENT_LIMIT_EXCEEDED. Request a smaller course/module/lesson anchor when bounded."
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "viewports": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "desktop",
                        "mobile"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 2
                  },
                  "moduleKey": {
                    "type": "string"
                  },
                  "lessonKey": {
                    "type": "string"
                  },
                  "itemId": {
                    "type": "string"
                  },
                  "view": {
                    "type": "string",
                    "enum": [
                      "WORKER",
                      "EMPLOYER_REVIEW"
                    ],
                    "description": "Optional view ASSERTION (DEV-2757): must equal the session’s current rendererView or the render fails 400. Not accepted with documentFormats (document captures are the worker view)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Hosted render evidence (artifacts + manifest)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LmsPreviewRenderResponse"
                }
              }
            }
          },
          "409": {
            "description": "State-revision, target, or capture conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Renderer service unavailable or at capacity (retryable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/step": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "stepLmsPreviewHosted",
        "summary": "Execute one closed typed step as a real hosted DOM click",
        "description": "Requires `lms:write` and `Idempotency-Key`. Executes exactly one closed op (`open_lesson` | `complete_content`) as real DOM clicks on stable product anchors in the hosted browser — never selectors, scripts, or coordinates. Returns before/after PNG evidence (per the capture mode), post-step ARIA, diagnostics, a manifest, and a canonical receipt whose before/after state revisions come from database readback with the intended postcondition asserted before APPLIED. A step whose outcome already holds returns ALREADY_SATISFIED (with a plain render, or a receipt-only manifest under capture \"none\"). Zero learner/domain writes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "op",
                  "lessonKey",
                  "expectedStateRevision"
                ],
                "properties": {
                  "op": {
                    "type": "string",
                    "enum": [
                      "open_lesson",
                      "complete_content"
                    ]
                  },
                  "lessonKey": {
                    "type": "string"
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "capture": {
                    "type": "string",
                    "enum": [
                      "before_after",
                      "after",
                      "none"
                    ],
                    "default": "before_after"
                  },
                  "viewport": {
                    "type": "string",
                    "enum": [
                      "desktop",
                      "mobile"
                    ],
                    "default": "desktop"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Step receipt + evidence",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "sessionId",
                    "sessionKind",
                    "evidenceClass",
                    "stateRevision",
                    "receipt",
                    "artifacts",
                    "manifest"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "sessionKind": {
                      "type": "string",
                      "enum": [
                        "SYNTHETIC_PREVIEW"
                      ]
                    },
                    "evidenceClass": {
                      "type": "string",
                      "enum": [
                        "SIMULATED_WORKER_PREVIEW"
                      ]
                    },
                    "stateRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "receipt": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "op",
                        "target",
                        "beforeStateRevision",
                        "afterStateRevision",
                        "beforeArtifactId",
                        "afterArtifactId",
                        "outcome",
                        "observations"
                      ],
                      "properties": {
                        "op": {
                          "type": "string",
                          "enum": [
                            "open_lesson",
                            "complete_content"
                          ]
                        },
                        "target": {
                          "type": "object"
                        },
                        "beforeStateRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "afterStateRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "beforeArtifactId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "afterArtifactId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "outcome": {
                          "type": "string",
                          "enum": [
                            "APPLIED",
                            "ALREADY_SATISFIED"
                          ]
                        },
                        "observations": {
                          "type": "object"
                        }
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsPreviewArtifact"
                      }
                    },
                    "manifest": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "State-revision conflict, anchor/postcondition failure, or target not on screen",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Renderer service unavailable or at capacity (retryable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/links": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "createLmsPreviewLink",
        "summary": "Mint a short-lived observe-only one-click human link",
        "description": "Requires `lms:write` and `Idempotency-Key`. Mints a single-use, expiring, revocable OBSERVE link deep-linked to a module or lesson (exact-question `itemId` grammar is RESERVED and fails typed `ITEM_LINK_UNAVAILABLE` until the Native Forms read-only adapter). The opener must be a SIGNED-IN member of the session’s organization — verified live at the exchange and on every read; a signed-out opener is routed through sign-in and the unconsumed link keeps working. The URL — whose fragment secret exchanges once into a read-only HttpOnly cookie — is returned ONLY on create; later reads can never recover it. After that first open it reopens only in the same browser. `link.expiresAt` is the real expiry: `ttlSeconds` is capped at the preview session’s own expiry. Assessment lessons list every question read-only and unanswered (no answer keys) without starting the assessment. Opening the link never mutates preview state, and expiring the session revokes every link atomically. A session whose course is archived is refused with 409 `COURSE_ARCHIVED`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "OBSERVE"
                    ],
                    "default": "OBSERVE"
                  },
                  "moduleKey": {
                    "type": "string"
                  },
                  "lessonKey": {
                    "type": "string"
                  },
                  "itemId": {
                    "type": "string",
                    "description": "RESERVED: currently fails typed ITEM_LINK_UNAVAILABLE (question links unlock with the Forms adapter)."
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400,
                    "default": 3600
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created observe link (URL returned only here)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link",
                    "url"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/LmsPreviewLink"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Session expired, item link unavailable, course archived (`COURSE_ARCHIVED`), or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsPreviewLinks",
        "summary": "List observe links for one preview session (records only)",
        "description": "Requires `lms:read`. Returns bounded pages of link records — status, target, timestamps. Plaintext tokens and one-click URLs are structurally unrecoverable.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Observe link records",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "sessionId",
                    "links",
                    "nextCursor"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsPreviewLink"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Preview session not found or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/links/{linkId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsPreviewLink",
        "summary": "Inspect one observe link (record only)",
        "description": "Requires `lms:read`. Returns the link record (ACTIVE/CONSUMED/REVOKED/EXPIRED); the plaintext token/URL is never recoverable.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Observe link record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/LmsPreviewLink"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Link or session not found, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/preview/sessions/{sessionId}/links/{linkId}/revoke": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "revokeLmsPreviewLink",
        "summary": "Revoke one observe link immediately (idempotent)",
        "description": "Requires `lms:write` and `Idempotency-Key`. Revocation is checked live on every observe request, so access cuts instantly; revoking an already revoked/expired link converges on the stored record.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked (or already terminal) observe link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/LmsPreviewLink"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Link or session not found, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/employer-links": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "createLmsEmployerPreviewLink",
        "summary": "Mint a single-use no-login employer preview link",
        "description": "Requires `lms:write` and `Idempotency-Key`. Mints a SINGLE-USE, expiring, revocable EMPLOYER link for one published version of a course your organization owns (omit `courseVersionId` for the current published version; the version read passes its own id). The employer opens it with NO OpenTrain login and sees the course the way assigned workers see it: never answers, rubrics or grading keys. The URL — whose fragment secret exchanges once into a read-only HttpOnly cookie — is returned ONLY on create (and on a same-key retry while unopened); a second open from another browser is refused. The page spends the one open only when the person clicks Open preview, so a mail scanner that loads the page does not use it up. `link.expiresAt` is the real expiry: `ttlSeconds` is silently capped at the backing preview session’s expiry, which is 2 hours after the mint. Each link creates its own preview session, which counts toward the organization’s 25 live preview sessions until that session expires; revoking the link does not free it. Mint and revoke share the 60-per-minute preview write budget (429 `RATE_LIMITED`). Every mint, open and revoke writes one LMS audit row. An archived course is refused with 409 `COURSE_ARCHIVED` (unarchive it first). A course another organization owns reads as `NOT_FOUND`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "courseVersionId": {
                    "type": "string"
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400,
                    "default": 3600
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created employer preview link (URL returned only here)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link",
                    "url"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/LmsEmployerPreviewLink"
                    },
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Course or version not found, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Course not published, course archived (`COURSE_ARCHIVED`), session expired, or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsEmployerPreviewLinks",
        "summary": "List employer preview links for one course (records only)",
        "description": "Requires `lms:read`. Returns bounded pages of employer link records — status and timestamps. Plaintext tokens and one-click URLs are structurally unrecoverable.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "courseVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Employer preview link records",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "courseId",
                    "links",
                    "nextCursor"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "courseId": {
                      "type": "string"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LmsEmployerPreviewLink"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Course not found or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/courses/{courseId}/employer-links/{linkId}/revoke": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "revokeLmsEmployerPreviewLink",
        "summary": "Revoke one employer preview link immediately (idempotent)",
        "description": "Requires `lms:write` and `Idempotency-Key`. Revocation is checked live on every read, so access cuts instantly; revoking an already revoked/expired link converges on the stored record. Writes one LMS audit row. The backing preview session keeps its live-session slot until it expires.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked (or already terminal) employer preview link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/LmsEmployerPreviewLink"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Link or course not found, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/capabilities": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "operationId": "getNativeFormPreviewCapabilities",
        "summary": "Static visual-proof capabilities",
        "description": "Requires `project_todos:read`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/sessions": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "operationId": "createNativeFormPreviewSession",
        "summary": "Create an idempotent visual-proof session pinned to the exact source",
        "description": "Requires `project_todos:write` and `Idempotency-Key`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "formId"
                ],
                "properties": {
                  "formId": {
                    "type": "string"
                  },
                  "draftRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "formVersionId": {
                    "type": "string"
                  },
                  "questionId": {
                    "type": "string"
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "draftRevision"
                    ],
                    "not": {
                      "required": [
                        "formVersionId"
                      ]
                    }
                  },
                  {
                    "required": [
                      "formVersionId"
                    ],
                    "not": {
                      "required": [
                        "draftRevision"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created session and one-time renderer link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/NativeFormPreviewSession"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Source not found or outside the caller organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Source revision, session ceiling, coverage gap, or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/sessions/{sessionId}": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "operationId": "getNativeFormPreviewSession",
        "summary": "Read one session with live source drift",
        "description": "Requires `project_todos:read`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session",
                    "sourceDrift"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/NativeFormPreviewSession"
                    },
                    "sourceDrift": {
                      "$ref": "#/components/schemas/PreviewSourceDrift"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown session, other product, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/sessions/{sessionId}/manage": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "operationId": "manageNativeFormPreviewSession",
        "summary": "select / expire / mint_link under the expected-state fence",
        "description": "Requires `project_todos:write` and `Idempotency-Key`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "action",
                  "expectedStateRevision"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "select",
                      "expire",
                      "mint_link"
                    ]
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "questionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/NativeFormPreviewSession"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "STATE_REVISION_CONFLICT, SESSION_EXPIRED, or KEY_REUSE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/sessions/{sessionId}/render": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "operationId": "renderNativeFormPreview",
        "summary": "Hosted desktop/mobile render with a verified evidence manifest",
        "description": "Requires `project_todos:write` and `Idempotency-Key`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent). Long-running (real Chromium). Same key + same payload returns the verified evidence set from storage without re-rendering.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedStateRevision"
                ],
                "properties": {
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "viewports": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 2,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "enum": [
                        "desktop",
                        "mobile"
                      ]
                    }
                  },
                  "questionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "documentFormats": {
                    "$schema": "http://json-schema.org/draft-07/schema#",
                    "minItems": 1,
                    "maxItems": 2,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "PDF",
                        "HTML"
                      ]
                    },
                    "uniqueItems": true,
                    "description": "Opt in to complete unanswered worker-view PDF/HTML (static raster pages; ARIA provides semantics). Fixed print viewport; omit viewports and clear item/question focus. At most 40 pages/200 units; no truncation. Live media or incomplete source returns DOCUMENT_INCOMPLETE; oversized documents return DOCUMENT_LIMIT_EXCEEDED. Request a smaller course/module/lesson anchor when bounded."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "READY evidence set with short-lived URLs",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "sessionId": {
                      "type": "string"
                    },
                    "sessionKind": {
                      "type": "string",
                      "const": "SYNTHETIC_PREVIEW"
                    },
                    "evidenceClass": {
                      "type": "string",
                      "const": "SIMULATED_WORKER_PREVIEW"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "stateRevision": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "renderRevision": {
                      "type": "string"
                    },
                    "target": {
                      "type": "object",
                      "properties": {
                        "product": {
                          "type": "string",
                          "const": "NATIVE_FORM"
                        },
                        "formId": {
                          "type": "string"
                        },
                        "questionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "product",
                        "formId",
                        "questionId"
                      ],
                      "additionalProperties": false
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "sessionId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "PENDING",
                              "READY",
                              "FAILED",
                              "EXPIRED"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "PNG",
                              "MANIFEST",
                              "ARIA_SNAPSHOT",
                              "DIAGNOSTICS",
                              "PDF",
                              "HTML"
                            ]
                          },
                          "viewport": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "desktop",
                                  "mobile"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "phase": {
                            "type": "string",
                            "enum": [
                              "RENDER",
                              "BEFORE_STEP",
                              "AFTER_STEP",
                              "NONE"
                            ]
                          },
                          "checksumSha256": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "byteSize": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "renderRevision": {
                            "type": "string"
                          },
                          "capturedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "expiresAt": {
                            "type": "string"
                          },
                          "url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "failure": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string",
                                    "enum": [
                                      "RENDERER_UNREACHABLE",
                                      "RENDERER_AUTH_REQUIRED",
                                      "READY_MARKER_TIMEOUT",
                                      "CAPTURE_TIMEOUT",
                                      "CAPTURE_CRASH",
                                      "UPLOAD_INCOMPLETE",
                                      "STALE_PENDING_EXPIRED",
                                      "DOCUMENT_LIMIT_EXCEEDED",
                                      "DOCUMENT_INCOMPLETE",
                                      "DOCUMENT_TIMEOUT"
                                    ]
                                  },
                                  "retryable": {
                                    "type": "boolean"
                                  },
                                  "remediation": {
                                    "type": "string"
                                  },
                                  "detail": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "failedAt": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "retryable",
                                  "remediation",
                                  "detail",
                                  "failedAt"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "sessionId",
                          "status",
                          "kind",
                          "viewport",
                          "phase",
                          "checksumSha256",
                          "byteSize",
                          "renderRevision",
                          "capturedAt",
                          "expiresAt",
                          "url",
                          "failure"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "manifest": {
                      "type": "object",
                      "properties": {
                        "sessionId": {
                          "type": "string"
                        },
                        "sessionKind": {
                          "type": "string",
                          "const": "SYNTHETIC_PREVIEW"
                        },
                        "evidenceClass": {
                          "type": "string",
                          "const": "SIMULATED_WORKER_PREVIEW"
                        },
                        "schemaVersion": {
                          "type": "string",
                          "const": "opentrain-preview-manifest/1"
                        },
                        "provenance": {
                          "type": "object",
                          "properties": {
                            "appCommit": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "rendererVersion": {
                              "type": "string"
                            },
                            "sourceDigest": {
                              "type": "string"
                            },
                            "stateRevision": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "capturedAt": {
                              "type": "string"
                            },
                            "locale": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "appCommit",
                            "rendererVersion",
                            "sourceDigest",
                            "stateRevision",
                            "capturedAt",
                            "locale"
                          ],
                          "additionalProperties": false
                        },
                        "evidenceArtifacts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "artifactId": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "PNG",
                                  "ARIA_SNAPSHOT",
                                  "DIAGNOSTICS",
                                  "PDF",
                                  "HTML"
                                ]
                              },
                              "viewport": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "desktop",
                                      "mobile"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "phase": {
                                "type": "string",
                                "enum": [
                                  "RENDER",
                                  "BEFORE_STEP",
                                  "AFTER_STEP",
                                  "NONE"
                                ]
                              },
                              "checksumSha256": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "byteSize": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              }
                            },
                            "required": [
                              "artifactId",
                              "kind",
                              "viewport",
                              "phase",
                              "checksumSha256",
                              "byteSize"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "diagnostics": {
                          "type": "object",
                          "properties": {
                            "consoleErrorCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "consoleWarningCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "pageErrorCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "failedRequestCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "readyWaitMs": {
                              "type": "number",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "consoleErrorCount",
                            "consoleWarningCount",
                            "pageErrorCount",
                            "failedRequestCount",
                            "readyWaitMs"
                          ],
                          "additionalProperties": false
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "document": {
                          "type": "object",
                          "properties": {
                            "pageCount": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 40
                            },
                            "unitCount": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 200
                            },
                            "representation": {
                              "type": "string",
                              "const": "WORKER_VIEW_RASTER"
                            },
                            "complete": {
                              "type": "boolean",
                              "const": true
                            }
                          },
                          "required": [
                            "pageCount",
                            "unitCount",
                            "representation",
                            "complete"
                          ],
                          "additionalProperties": false
                        },
                        "product": {
                          "type": "string",
                          "const": "NATIVE_FORM"
                        },
                        "target": {
                          "type": "object",
                          "properties": {
                            "product": {
                              "type": "string",
                              "const": "NATIVE_FORM"
                            },
                            "formId": {
                              "type": "string"
                            },
                            "questionId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "product",
                            "formId",
                            "questionId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "sessionId",
                        "sessionKind",
                        "evidenceClass",
                        "schemaVersion",
                        "provenance",
                        "evidenceArtifacts",
                        "diagnostics",
                        "warnings",
                        "product",
                        "target"
                      ],
                      "additionalProperties": false
                    },
                    "zeroDomainWrites": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "sessionId",
                    "sessionKind",
                    "evidenceClass",
                    "ok",
                    "stateRevision",
                    "renderRevision",
                    "target",
                    "artifacts",
                    "manifest",
                    "zeroDomainWrites"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "STATE_REVISION_CONFLICT, TARGET_MISMATCH, SESSION_EXPIRED, recovery, or coverage conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Renderer, storage, or evidence links temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/sessions/{sessionId}/artifacts": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "operationId": "listNativeFormPreviewArtifacts",
        "summary": "List evidence artifacts with short-lived download URLs",
        "description": "Requires `project_todos:read`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Artifact page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "artifacts",
                    "nextCursor"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PreviewEvidenceArtifact"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/artifacts/{artifactId}": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "operationId": "getNativeFormPreviewArtifact",
        "summary": "Read one evidence artifact (fresh short-lived URL)",
        "description": "Requires `project_todos:read`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Artifact",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "artifact"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "artifact": {
                      "$ref": "#/components/schemas/PreviewEvidenceArtifact"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown artifact, other product, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/sessions/{sessionId}/links": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "operationId": "createNativeFormPreviewLink",
        "summary": "Mint a single-use humans-only observe link",
        "description": "Requires `project_todos:write` and `Idempotency-Key`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent). The opener must be a signed-in member of the session organization; the URL is returned only on the minting response and identical same-key replays.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Observe link and one-click URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link",
                    "url"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/PreviewObserveLink"
                    },
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "SESSION_EXPIRED or KEY_REUSE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "project-todos"
        ],
        "operationId": "listNativeFormPreviewLinks",
        "summary": "List observe links (records only, never tokens)",
        "description": "Requires `project_todos:read`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Link page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "links",
                    "nextCursor"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PreviewObserveLink"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/preview/sessions/{sessionId}/links/{linkId}/revoke": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "operationId": "revokeNativeFormPreviewLink",
        "summary": "Revoke one observe link immediately (idempotent)",
        "description": "Requires `project_todos:write` and `Idempotency-Key`. DEV-2678 Native Forms / quiz hosted visual proof over the DEV-2735 shared preview core: a SIMULATED_WORKER_PREVIEW of ONE pinned form draft revision (+ content hash) or published version rendered by the REAL worker form runner in real Chromium. Zero domain writes — no attempts, answers, grades, releases, To-do transitions, notifications, or audit completion; the renderer payload is the worker-safe projection (answer keys structurally absent).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Observe link record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/PreviewObserveLink"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Link or session not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/capabilities": {
      "get": {
        "tags": [
          "instructions"
        ],
        "operationId": "getInstructionsVisualCapabilities",
        "summary": "Static visual-proof capabilities",
        "description": "Requires `instructions:read`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/sessions": {
      "post": {
        "tags": [
          "instructions"
        ],
        "operationId": "createInstructionsVisualSession",
        "summary": "Create an idempotent visual-proof session pinned to the exact source",
        "description": "Requires `instructions:write` and `Idempotency-Key`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "jobId"
                ],
                "properties": {
                  "jobId": {
                    "type": "string"
                  },
                  "audience": {
                    "type": "string",
                    "enum": [
                      "EMPLOYER",
                      "WORKER"
                    ],
                    "default": "EMPLOYER"
                  },
                  "workerContractId": {
                    "type": "string",
                    "description": "WORKER only: an ACTIVE contract on this job whose worker is a designated test-worker account."
                  },
                  "pageId": {
                    "type": "string"
                  },
                  "nodeId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created session and one-time renderer link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/InstructionsVisualSession"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Source not found or outside the caller organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Source revision, session ceiling, coverage gap, or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/sessions/{sessionId}": {
      "get": {
        "tags": [
          "instructions"
        ],
        "operationId": "getInstructionsVisualSession",
        "summary": "Read one session with live source drift",
        "description": "Requires `instructions:read`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session",
                    "sourceDrift",
                    "browserRenderVerified"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/InstructionsVisualSession"
                    },
                    "sourceDrift": {
                      "$ref": "#/components/schemas/PreviewSourceDrift"
                    },
                    "browserRenderVerified": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown session, other product, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/sessions/{sessionId}/manage": {
      "post": {
        "tags": [
          "instructions"
        ],
        "operationId": "manageInstructionsVisualSession",
        "summary": "select / expire / mint_link under the expected-state fence",
        "description": "Requires `instructions:write` and `Idempotency-Key`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "action",
                  "expectedStateRevision"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "select",
                      "expire",
                      "mint_link"
                    ]
                  },
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "pageId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "nodeId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "session"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "session": {
                      "$ref": "#/components/schemas/InstructionsVisualSession"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "STATE_REVISION_CONFLICT, SESSION_EXPIRED, or KEY_REUSE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/sessions/{sessionId}/render": {
      "post": {
        "tags": [
          "instructions"
        ],
        "operationId": "renderInstructionsVisual",
        "summary": "Hosted desktop/mobile render with a verified evidence manifest",
        "description": "Requires `instructions:write` and `Idempotency-Key`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout. Long-running (real Chromium). Same key + same payload returns the verified evidence set from storage without re-rendering. YouTube (www.youtube-nocookie.com) and Loom player frames load in the proof; every other third-party embed is blocked by the renderer egress policy by design and renders blank, and renderWarnings reports those as closed codes with counts (THIRD_PARTY_EMBED_BLOCKED), never URLs, and manifest.warnings carries the same fact as a coded string.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          },
          {
            "name": "X-OpenTrain-Features",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opt into the typed `renderWarnings` list with the token `instructions-render-warnings-v1`. Omit for the legacy response shape; the coded `manifest.warnings` string is returned either way."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedStateRevision"
                ],
                "properties": {
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "viewports": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 2,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "enum": [
                        "desktop",
                        "mobile"
                      ]
                    }
                  },
                  "pageId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "nodeId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "syncProbe": {
                    "$schema": "http://json-schema.org/draft-07/schema#",
                    "type": "object",
                    "properties": {
                      "timeoutMs": {
                        "type": "integer",
                        "minimum": 5000,
                        "maximum": 45000
                      },
                      "expectedPageChecksum": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "expectedTreeChecksum": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    },
                    "required": [
                      "timeoutMs"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "READY evidence set with short-lived URLs",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "sessionKind": {
                      "type": "string",
                      "const": "SCOPED_APP_VIEW"
                    },
                    "evidenceClass": {
                      "type": "string",
                      "const": "AUTHENTICATED_APP_VIEW"
                    },
                    "audience": {
                      "type": "string",
                      "enum": [
                        "EMPLOYER",
                        "WORKER"
                      ]
                    },
                    "stateRevision": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "renderRevision": {
                      "type": "string"
                    },
                    "target": {
                      "type": "object",
                      "properties": {
                        "product": {
                          "type": "string",
                          "const": "JOB_INSTRUCTIONS"
                        },
                        "instructionSetId": {
                          "type": "string"
                        },
                        "pageId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "nodeId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "product",
                        "instructionSetId",
                        "pageId",
                        "nodeId"
                      ],
                      "additionalProperties": false
                    },
                    "sourceDrift": {
                      "type": "object",
                      "properties": {
                        "pinnedDigest": {
                          "type": "string"
                        },
                        "observedDigest": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "boolean"
                        },
                        "observedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "pinnedDigest",
                        "observedDigest",
                        "changed",
                        "observedAt"
                      ],
                      "additionalProperties": false
                    },
                    "workerCoverage": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "included": {
                              "type": "boolean",
                              "const": true
                            },
                            "basis": {
                              "type": "string",
                              "const": "REAL_TEST_WORKER_CONTRACT"
                            },
                            "contractId": {
                              "type": "string"
                            },
                            "evidenceClass": {
                              "type": "string",
                              "const": "AUTHENTICATED_APP_VIEW"
                            }
                          },
                          "required": [
                            "included",
                            "basis",
                            "contractId",
                            "evidenceClass"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "included": {
                              "type": "boolean",
                              "const": false
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "NO_TEST_WORKER_CONTRACT",
                                "CONTRACT_NOT_TEST_WORKER",
                                "CONTRACT_NOT_ACTIVE",
                                "WORKER_ACCESS_DENIED",
                                "NOT_APPLICABLE"
                              ]
                            },
                            "requirement": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "included",
                            "reason",
                            "requirement"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "browserRenderVerified": {
                      "type": "boolean",
                      "const": true
                    },
                    "collaborationSyncVerified": {
                      "type": "boolean",
                      "const": false
                    },
                    "livePropagationVerified": {
                      "type": "boolean"
                    },
                    "propagationSurface": {
                      "type": "string",
                      "const": "SCOPED_READ_ONLY_VIEW"
                    },
                    "syncReport": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "OBSERVED",
                            "VERIFIED",
                            "CANONICAL_MISMATCH",
                            "TIMEOUT",
                            "BASELINE_MISMATCH",
                            "AUTH_FAILURE",
                            "AVAILABILITY_FAILURE",
                            "VIEW_NAVIGATED",
                            "VIEW_UNAVAILABLE"
                          ]
                        },
                        "baseline": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "pageId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "pageChecksum": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "treeChecksum": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "bodyRenderHash": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "treeRenderHash": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "jobRevision": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "folderRevision": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              },
                              "required": [
                                "pageId",
                                "pageChecksum",
                                "treeChecksum",
                                "bodyRenderHash",
                                "treeRenderHash",
                                "jobRevision",
                                "folderRevision"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "observed": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "pageId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "pageChecksum": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "treeChecksum": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "bodyRenderHash": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "treeRenderHash": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "jobRevision": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "folderRevision": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              },
                              "required": [
                                "pageId",
                                "pageChecksum",
                                "treeChecksum",
                                "bodyRenderHash",
                                "treeRenderHash",
                                "jobRevision",
                                "folderRevision"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "elapsedMs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 120000
                        },
                        "sameDocument": {
                          "type": "boolean"
                        },
                        "authFailureObserved": {
                          "type": "boolean"
                        },
                        "availabilityFailureObserved": {
                          "type": "boolean"
                        },
                        "unavailableReadCount": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "firstFailure": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                "status": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 400,
                                      "maximum": 599
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "path",
                                "status"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "status",
                        "baseline",
                        "observed",
                        "elapsedMs",
                        "sameDocument",
                        "authFailureObserved",
                        "availabilityFailureObserved",
                        "unavailableReadCount",
                        "firstFailure"
                      ],
                      "additionalProperties": false
                    },
                    "renderWarnings": {
                      "maxItems": 1,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "THIRD_PARTY_EMBED_BLOCKED"
                            ]
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 500
                          }
                        },
                        "required": [
                          "code",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "sessionId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "const": "READY"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "PNG",
                              "ARIA_SNAPSHOT",
                              "DIAGNOSTICS",
                              "MANIFEST"
                            ]
                          },
                          "viewport": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "desktop",
                                  "mobile"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "phase": {
                            "type": "string",
                            "enum": [
                              "RENDER",
                              "BEFORE_STEP",
                              "AFTER_STEP",
                              "NONE"
                            ]
                          },
                          "checksumSha256": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                          },
                          "byteSize": {
                            "type": "integer",
                            "exclusiveMinimum": 0
                          },
                          "renderRevision": {
                            "type": "string"
                          },
                          "capturedAt": {
                            "type": "string"
                          },
                          "expiresAt": {
                            "type": "string"
                          },
                          "failure": {
                            "type": "null"
                          },
                          "url": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "sessionId",
                          "status",
                          "kind",
                          "viewport",
                          "phase",
                          "checksumSha256",
                          "byteSize",
                          "renderRevision",
                          "capturedAt",
                          "expiresAt",
                          "failure",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "manifest": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "string",
                          "const": "opentrain-preview-manifest/1"
                        },
                        "product": {
                          "type": "string",
                          "const": "JOB_INSTRUCTIONS"
                        },
                        "sessionKind": {
                          "type": "string",
                          "const": "SCOPED_APP_VIEW"
                        },
                        "evidenceClass": {
                          "type": "string",
                          "const": "AUTHENTICATED_APP_VIEW"
                        },
                        "sessionId": {
                          "type": "string"
                        },
                        "target": {
                          "type": "object",
                          "properties": {
                            "product": {
                              "type": "string",
                              "const": "JOB_INSTRUCTIONS"
                            },
                            "instructionSetId": {
                              "type": "string"
                            },
                            "pageId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "nodeId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "product",
                            "instructionSetId",
                            "pageId",
                            "nodeId"
                          ],
                          "additionalProperties": false
                        },
                        "provenance": {
                          "type": "object",
                          "properties": {
                            "appCommit": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "rendererVersion": {
                              "type": "string"
                            },
                            "sourceDigest": {
                              "type": "string"
                            },
                            "stateRevision": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "capturedAt": {
                              "type": "string"
                            },
                            "locale": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "appCommit",
                            "rendererVersion",
                            "sourceDigest",
                            "stateRevision",
                            "capturedAt",
                            "locale"
                          ],
                          "additionalProperties": false
                        },
                        "evidenceArtifacts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "artifactId": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "PNG",
                                  "ARIA_SNAPSHOT",
                                  "DIAGNOSTICS"
                                ]
                              },
                              "viewport": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "desktop",
                                      "mobile"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "phase": {
                                "type": "string",
                                "enum": [
                                  "RENDER",
                                  "BEFORE_STEP",
                                  "AFTER_STEP",
                                  "NONE"
                                ]
                              },
                              "checksumSha256": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "byteSize": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              }
                            },
                            "required": [
                              "artifactId",
                              "kind",
                              "viewport",
                              "phase",
                              "checksumSha256",
                              "byteSize"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "diagnostics": {
                          "type": "object",
                          "properties": {
                            "consoleErrorCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "consoleWarningCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "pageErrorCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "failedRequestCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "readyWaitMs": {
                              "type": "number",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "consoleErrorCount",
                            "consoleWarningCount",
                            "pageErrorCount",
                            "failedRequestCount",
                            "readyWaitMs"
                          ],
                          "additionalProperties": false
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "sourceDrift": {
                          "type": "object",
                          "properties": {
                            "pinnedDigest": {
                              "type": "string"
                            },
                            "observedDigest": {
                              "type": "string"
                            },
                            "changed": {
                              "type": "boolean"
                            },
                            "observedAt": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "pinnedDigest",
                            "observedDigest",
                            "changed",
                            "observedAt"
                          ],
                          "additionalProperties": false
                        },
                        "workerCoverage": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "included": {
                                  "type": "boolean",
                                  "const": true
                                },
                                "basis": {
                                  "type": "string",
                                  "const": "REAL_TEST_WORKER_CONTRACT"
                                },
                                "contractId": {
                                  "type": "string"
                                },
                                "evidenceClass": {
                                  "type": "string",
                                  "const": "AUTHENTICATED_APP_VIEW"
                                }
                              },
                              "required": [
                                "included",
                                "basis",
                                "contractId",
                                "evidenceClass"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "included": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "reason": {
                                  "type": "string",
                                  "enum": [
                                    "NO_TEST_WORKER_CONTRACT",
                                    "CONTRACT_NOT_TEST_WORKER",
                                    "CONTRACT_NOT_ACTIVE",
                                    "WORKER_ACCESS_DENIED",
                                    "NOT_APPLICABLE"
                                  ]
                                },
                                "requirement": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "included",
                                "reason",
                                "requirement"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        "syncReport": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "OBSERVED",
                                "VERIFIED",
                                "CANONICAL_MISMATCH",
                                "TIMEOUT",
                                "BASELINE_MISMATCH",
                                "AUTH_FAILURE",
                                "AVAILABILITY_FAILURE",
                                "VIEW_NAVIGATED",
                                "VIEW_UNAVAILABLE"
                              ]
                            },
                            "baseline": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "pageId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "pageChecksum": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "treeChecksum": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "bodyRenderHash": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "treeRenderHash": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "jobRevision": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "folderRevision": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "pageId",
                                    "pageChecksum",
                                    "treeChecksum",
                                    "bodyRenderHash",
                                    "treeRenderHash",
                                    "jobRevision",
                                    "folderRevision"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "observed": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "pageId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "pageChecksum": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "treeChecksum": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "bodyRenderHash": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "treeRenderHash": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "jobRevision": {
                                      "type": "integer",
                                      "minimum": 0
                                    },
                                    "folderRevision": {
                                      "type": "integer",
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "pageId",
                                    "pageChecksum",
                                    "treeChecksum",
                                    "bodyRenderHash",
                                    "treeRenderHash",
                                    "jobRevision",
                                    "folderRevision"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "elapsedMs": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 120000
                            },
                            "sameDocument": {
                              "type": "boolean"
                            },
                            "authFailureObserved": {
                              "type": "boolean"
                            },
                            "availabilityFailureObserved": {
                              "type": "boolean"
                            },
                            "unavailableReadCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "firstFailure": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "path": {
                                      "type": "string",
                                      "maxLength": 200
                                    },
                                    "status": {
                                      "anyOf": [
                                        {
                                          "type": "integer",
                                          "minimum": 400,
                                          "maximum": 599
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "path",
                                    "status"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "status",
                            "baseline",
                            "observed",
                            "elapsedMs",
                            "sameDocument",
                            "authFailureObserved",
                            "availabilityFailureObserved",
                            "unavailableReadCount",
                            "firstFailure"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "product",
                        "sessionKind",
                        "evidenceClass",
                        "sessionId",
                        "target",
                        "provenance",
                        "evidenceArtifacts",
                        "diagnostics",
                        "warnings",
                        "sourceDrift",
                        "workerCoverage"
                      ],
                      "additionalProperties": false
                    },
                    "zeroDomainWrites": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "sessionId",
                    "sessionKind",
                    "evidenceClass",
                    "audience",
                    "stateRevision",
                    "renderRevision",
                    "target",
                    "sourceDrift",
                    "workerCoverage",
                    "browserRenderVerified",
                    "collaborationSyncVerified",
                    "artifacts",
                    "manifest",
                    "zeroDomainWrites"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "STATE_REVISION_CONFLICT, TARGET_MISMATCH, SESSION_EXPIRED, recovery, or coverage conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Renderer, storage, or evidence links temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/sessions/{sessionId}/artifacts": {
      "get": {
        "tags": [
          "instructions"
        ],
        "operationId": "listInstructionsVisualArtifacts",
        "summary": "List evidence artifacts with short-lived download URLs",
        "description": "Requires `instructions:read`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Artifact page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "artifacts",
                    "nextCursor"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PreviewEvidenceArtifact"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/artifacts/{artifactId}": {
      "get": {
        "tags": [
          "instructions"
        ],
        "operationId": "getInstructionsVisualArtifact",
        "summary": "Read one evidence artifact (fresh short-lived URL)",
        "description": "Requires `instructions:read`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "artifactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Artifact",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "artifact"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "artifact": {
                      "$ref": "#/components/schemas/PreviewEvidenceArtifact"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown artifact, other product, or outside tenant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/sessions/{sessionId}/links": {
      "post": {
        "tags": [
          "instructions"
        ],
        "operationId": "createInstructionsVisualLink",
        "summary": "Mint a single-use humans-only observe link",
        "description": "Requires `instructions:write` and `Idempotency-Key`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout. The opener must be a signed-in member of the session organization; the URL is returned only on the minting response and identical same-key replays.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Observe link and one-click URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link",
                    "url"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/PreviewObserveLink"
                    },
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "SESSION_EXPIRED or KEY_REUSE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "instructions"
        ],
        "operationId": "listInstructionsVisualLinks",
        "summary": "List observe links (records only, never tokens)",
        "description": "Requires `instructions:read`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Link page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "links",
                    "nextCursor"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PreviewObserveLink"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/instructions/visual/sessions/{sessionId}/links/{linkId}/revoke": {
      "post": {
        "tags": [
          "instructions"
        ],
        "operationId": "revokeInstructionsVisualLink",
        "summary": "Revoke one observe link immediately (idempotent)",
        "description": "Requires `instructions:write` and `Idempotency-Key`. DEV-2733 job Instructions authenticated visual proof over the DEV-2735 shared preview core: an AUTHENTICATED_APP_VIEW of the REAL employer Instructions workspace — or, ONLY through a real designated test-worker contract, the real worker reader — rendered in real Chromium under a least-privilege, expiring, revocable session. Every render reports sourceDrift (pinned vs live checksums) and TYPED workerCoverage (never synthetic, never NOT_APPLICABLE); all renders keep collaborationSyncVerified false; successful probes set livePropagationVerified true with propagationSurface SCOPED_READ_ONLY_VIEW. Opt-in render syncProbe {timeoutMs:5000..45000} watches one already-open desktop view for external body AND tree commits without writes/reloads; failed proof is 409 COLLABORATION_SYNC_NOT_VERIFIED with report and artifact IDs; same-key replay never repeats it; interrupted experiments require a new key. Read-only. Also requires the per-actor instructions_visual_proof rollout.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated key (8-200 chars). The same key with the same payload converges on one durable receipt; the same key with a different payload is a 409 KEY_REUSE conflict.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Observe link record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "link"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "link": {
                      "$ref": "#/components/schemas/PreviewObserveLink"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Link or session not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}": {
      "get": {
        "operationId": "getFolderInstructions",
        "x-agent-operation-id": "folder_instructions.inspect",
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Inspect folder Instructions",
        "description": "Inventory a folder and every child job, including archived/hidden pages and current worker-visible page IDs. Metadata-only by default; includeContent opts into bounded provider reads. No writes or activation. Explicit delivery limitations refuse unsafe published-mode writes.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "includeContent",
            "in": "query",
            "required": false,
            "description": "Defaults false. Explicit bounded provider-content read; never activates Instructions.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionInspectResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/changes/preview": {
      "post": {
        "operationId": "previewFolderInstructionChange",
        "x-agent-operation-id": "folder_instructions.changes.preview",
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Preview folder Instructions change",
        "description": "Preview ACTIVATE, APPEND or guarded REVERSE with zero writes. Returns the exact job/source/destination mapping, hidden content, expanded worker audience and digest. Inspect canApply/findings; unknown fields, oversized inventories and unavailable links/media are refused. No release/read/ack cutover.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionPreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/changes/confirm": {
      "post": {
        "operationId": "confirmFolderInstructionChange",
        "x-agent-operation-id": "folder_instructions.changes.confirm",
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Confirm reviewed folder Instructions change",
        "description": "Confirm the exact reviewed request and digest using a stable idempotencyKey and confirmed=true. Rechecks current access and stale sources before freezing editors. This starts the drain, not worker visibility. Keep the operationId; wait until quiesceReadyAt before apply. Never silently regenerate a stale plan.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionConfirmRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionConfirmResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/changes/{operationId}": {
      "get": {
        "operationId": "getFolderInstructionChange",
        "x-agent-operation-id": "folder_instructions.changes.get",
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Read folder Instructions operation status",
        "description": "Read one current-authorized operation, drain/lease times and immutable cutover receipt. Strictly read-only: does not apply or renew a lease. COMMITTED is not VERIFIED_READBACK. Recover uncertain writes with this operation ID, never a new activation key.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/changes/{operationId}/apply": {
      "post": {
        "operationId": "applyFolderInstructionChange",
        "x-agent-operation-id": "folder_instructions.changes.apply",
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Apply confirmed folder Instructions change",
        "description": "Apply a confirmed operation after its editor drain with confirmed=true. Preserves originals, verifies destination content/media and atomically changes inheritance. Reuses the original key via operationId. EXECUTOR_FENCED requires status/drain or explicit resume; committed-readback errors require the SAME operation, never another activation.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionApplyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/changes/{operationId}/cancel": {
      "post": {
        "operationId": "cancelFolderInstructionChange",
        "x-agent-operation-id": "folder_instructions.changes.cancel",
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Cancel uncommitted folder Instructions change",
        "description": "Cancel an uncommitted reviewed operation with confirmed=true; originals remain retained and no partial destination is exposed. Cannot undo a committed operation: preview REVERSE instead. Safe same-operation retry.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionCancelResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/changes/{operationId}/resume": {
      "post": {
        "operationId": "resumeFolderInstructionChange",
        "x-agent-operation-id": "folder_instructions.changes.resume",
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Resume expired folder Instructions operation",
        "description": "Explicitly re-admit an expired operation with confirmed=true after current authorization and unchanged-source checks. Status never does this automatically. A changed source requires a fresh preview; a new drain may be required. Resume is not an apply.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionResumeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionResumeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/changes/{operationId}/recovery": {
      "get": {
        "operationId": "exportFolderInstructionRecovery",
        "x-agent-operation-id": "folder_instructions.changes.recovery.export",
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Export retained folder Instructions originals",
        "description": "Export exact retained checkpoints and original metadata for an authorized employer. Read-only, bounded, includes originally/currently archived state and exact destination IDs. Not a worker reader; retention is not permission to restore old guidance. Use preview REVERSE for guarded reversal.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical bounded result. Confirmation starts a drain; only verified apply completes visibility/readback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionRecoveryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder or operation not available to the current actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale plan, incompatible publication, executor/drain fence, or committed readback pending. Inspect the same operation; never blindly create another key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded request/content/inventory capacity exceeded; no truncated plan is applicable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages": {
      "get": {
        "operationId": "getFolderInstructionPages",
        "x-agent-operation-id": "folder_instructions.pages.list",
        "x-agent-operation-ids": [
          "folder_instructions.pages.list"
        ],
        "x-sdk-methods": [
          "getFolderInstructionPages"
        ],
        "x-cli-commands": [
          "instructions inspect --folder <folderId>",
          "instructions pages list --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Read folder page tree",
        "description": "Read the active authoring tree. Use folder inventory instead to see child jobs and hidden originals; neither activates Instructions. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringPagesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createFolderInstructionPage",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "DURABLE_RECEIPT",
          "keyRequirement": "SAME_KEY_AND_PAYLOAD",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages"
            }
          ],
          "identityFields": [
            "folderId",
            "idempotencyKey",
            "exactRequestPayload"
          ],
          "allowedRetryAction": "Repeat only the identical key and payload to recover the durable receipt; then inspect canonical readback. Never allocate a new key for an uncertain outcome.",
          "staleStateBehavior": "A key/payload conflict requires inspection, not a new identity or blind retry.",
          "stateActions": {
            "UNCERTAIN": "SAME_KEY_AND_PAYLOAD",
            "REPLAYED": "INSPECT_CANONICAL_READBACK",
            "UPLOAD_GRANT_NOT_REPLAYABLE": "INSPECT_SAME_ASSET_NEVER_REISSUE_GRANT"
          }
        },
        "x-agent-operation-id": "folder_instructions.page.create",
        "x-agent-operation-ids": [
          "folder_instructions.page.create"
        ],
        "x-sdk-methods": [
          "createFolderInstructionPage"
        ],
        "x-cli-commands": [
          "instructions page create --folder <folderId>",
          "instructions import docx --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Create folder page",
        "description": "Create a root/subpage using the exact signed preflight. Use the same idempotencyKey on retries; first activation is a separate reviewed operation. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable retry identity; must match body.idempotencyKey when present. Never use a fresh key after an uncertain write.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringCreatePageRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringCreatePageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages/{pageId}": {
      "get": {
        "operationId": "getFolderInstructionPage",
        "x-agent-operation-id": "folder_instructions.page.get",
        "x-agent-operation-ids": [
          "folder_instructions.page.get"
        ],
        "x-sdk-methods": [
          "getFolderInstructionPage"
        ],
        "x-cli-commands": [
          "instructions page get --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Read folder page",
        "description": "Read one active canonical rich document and checksum. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringReadPageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "replaceFolderInstructionPage",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "SIGNED_PREFLIGHT_INSPECTION",
          "keyRequirement": "NO_CLIENT_KEY",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}"
            },
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages"
            }
          ],
          "identityFields": [
            "folderId",
            "pageId",
            "expectedChecksum",
            "reviewedTreeChecksum",
            "reviewedResultFingerprint"
          ],
          "allowedRetryAction": "Inspect current page and tree first. Report convergence only with the exact target identity and all reviewed result fingerprints. Otherwise obtain a fresh preflight and explicitly confirm it. Do not resend a timed-out write blindly.",
          "staleStateBehavior": "Changed identity/checksum/tree or unavailable comparison evidence requires a fresh reviewed preflight. An archive 404 is not proof of archival.",
          "stateActions": {
            "EXACT_REVIEWED_RESULT": "REPORT_VERIFIED_CONVERGENCE",
            "CHANGED": "FRESH_REVIEWED_PREFLIGHT_REQUIRED",
            "UNKNOWN": "INSPECT_DO_NOT_REPEAT",
            "NOT_FOUND": "UNKNOWN_NOT_SUCCESS"
          }
        },
        "x-agent-operation-id": "folder_instructions.page.replace",
        "x-agent-operation-ids": [
          "folder_instructions.page.replace"
        ],
        "x-sdk-methods": [
          "replaceFolderInstructionPage"
        ],
        "x-cli-commands": [
          "instructions page replace --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Replace folder document",
        "description": "Replace a page after reviewing its exact checksum/content; confirmReplace and confirmLive are mandatory. On an uncertain response read current content before retry. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringReplacePageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringReplacePageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patchFolderInstructionPage",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "SIGNED_PREFLIGHT_INSPECTION",
          "keyRequirement": "NO_CLIENT_KEY",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}"
            },
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages"
            }
          ],
          "identityFields": [
            "folderId",
            "pageId",
            "expectedChecksum",
            "reviewedTreeChecksum",
            "reviewedResultFingerprint"
          ],
          "allowedRetryAction": "Inspect current page and tree first. Report convergence only with the exact target identity and all reviewed result fingerprints. Otherwise obtain a fresh preflight and explicitly confirm it. Do not resend a timed-out write blindly.",
          "staleStateBehavior": "Changed identity/checksum/tree or unavailable comparison evidence requires a fresh reviewed preflight. An archive 404 is not proof of archival.",
          "stateActions": {
            "EXACT_REVIEWED_RESULT": "REPORT_VERIFIED_CONVERGENCE",
            "CHANGED": "FRESH_REVIEWED_PREFLIGHT_REQUIRED",
            "UNKNOWN": "INSPECT_DO_NOT_REPEAT",
            "NOT_FOUND": "UNKNOWN_NOT_SUCCESS"
          }
        },
        "x-agent-operation-id": "folder_instructions.page.patch",
        "x-agent-operation-ids": [
          "folder_instructions.page.patch",
          "folder_instructions.page.update"
        ],
        "x-sdk-methods": [
          "patchFolderInstructionPage",
          "updateFolderInstructionPage"
        ],
        "x-cli-commands": [
          "instructions page patch --folder <folderId>",
          "instructions page rename --folder <folderId>",
          "instructions page icon --folder <folderId>",
          "instructions page move --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Patch folder content or update page metadata",
        "description": "Apply stable-node patches with expected checksum and signed preflight; never silently overwrite concurrent edits. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags. Alternatively: Rename, set/clear icon or move a page using the reviewed preflight. No document replacement. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/FolderInstructionAuthoringPatchPageRequest"
                  },
                  {
                    "$ref": "#/components/schemas/FolderInstructionAuthoringUpdatePageRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringPatchPageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "archiveFolderInstructionPage",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "SIGNED_PREFLIGHT_INSPECTION",
          "keyRequirement": "NO_CLIENT_KEY",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}"
            },
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages"
            }
          ],
          "identityFields": [
            "folderId",
            "pageId",
            "expectedChecksum",
            "reviewedTreeChecksum",
            "reviewedResultFingerprint"
          ],
          "allowedRetryAction": "Inspect current page and tree first. Report convergence only with the exact target identity and all reviewed result fingerprints. Otherwise obtain a fresh preflight and explicitly confirm it. Do not resend a timed-out write blindly.",
          "staleStateBehavior": "Changed identity/checksum/tree or unavailable comparison evidence requires a fresh reviewed preflight. An archive 404 is not proof of archival.",
          "stateActions": {
            "EXACT_REVIEWED_RESULT": "REPORT_VERIFIED_CONVERGENCE",
            "CHANGED": "FRESH_REVIEWED_PREFLIGHT_REQUIRED",
            "UNKNOWN": "INSPECT_DO_NOT_REPEAT",
            "NOT_FOUND": "UNKNOWN_NOT_SUCCESS"
          }
        },
        "x-agent-operation-id": "folder_instructions.page.archive",
        "x-agent-operation-ids": [
          "folder_instructions.page.archive"
        ],
        "x-sdk-methods": [
          "archiveFolderInstructionPage"
        ],
        "x-cli-commands": [
          "instructions page archive --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Archive folder page",
        "description": "Archive the reviewed page and its children. Removing the last folder page does not resurrect archived job guidance. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringArchivePageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringArchivePageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/preview": {
      "post": {
        "operationId": "previewFolderInstructionPage",
        "x-agent-operation-id": "folder_instructions.page.preview",
        "x-agent-operation-ids": [
          "folder_instructions.page.preview"
        ],
        "x-sdk-methods": [
          "previewFolderInstructionPage"
        ],
        "x-cli-commands": [
          "instructions page preview --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Preview folder document",
        "description": "Validate and render a document without writes, with the same validation as create/replace preflight (canApply is false on any ERROR finding). Supply pageId in request to use its persisted schema, or contentSchemaVersion for a new page. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringPreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/preflight": {
      "post": {
        "operationId": "preflightFolderInstructionOperation",
        "x-agent-operation-id": "folder_instructions.page.preflight",
        "x-agent-operation-ids": [
          "folder_instructions.page.preflight"
        ],
        "x-sdk-methods": [
          "preflightFolderInstructionOperation"
        ],
        "x-cli-commands": [
          "instructions page create --folder <folderId>",
          "instructions page replace --folder <folderId>",
          "instructions page patch --folder <folderId>",
          "instructions page rename --folder <folderId>",
          "instructions page icon --folder <folderId>",
          "instructions page move --folder <folderId>",
          "instructions page archive --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Preflight folder edit",
        "description": "Review an exact page edit without writes; returned token binds target/content/checksum. Inspect canApply and findings before apply. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/tree/preflight": {
      "post": {
        "operationId": "preflightFolderInstructionTree",
        "x-agent-operation-id": "folder_instructions.tree.preflight",
        "x-agent-operation-ids": [
          "folder_instructions.tree.preflight"
        ],
        "x-sdk-methods": [
          "preflightFolderInstructionTree"
        ],
        "x-cli-commands": [
          "instructions plan --folder <folderId>",
          "instructions apply --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Preflight folder tree",
        "description": "Review the complete desired tree and exact archive set without writes; preserve schema versions, checksum and idempotency key. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringTreePreflightRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringTreePreflightResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/tree/apply": {
      "post": {
        "operationId": "applyFolderInstructionTree",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "DURABLE_RECEIPT",
          "keyRequirement": "SAME_KEY_AND_PAYLOAD",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages"
            }
          ],
          "identityFields": [
            "folderId",
            "idempotencyKey",
            "exactRequestPayload"
          ],
          "allowedRetryAction": "Repeat only the identical key and payload to recover the durable receipt; then inspect canonical readback. Never allocate a new key for an uncertain outcome.",
          "staleStateBehavior": "A key/payload conflict requires inspection, not a new identity or blind retry.",
          "stateActions": {
            "UNCERTAIN": "SAME_KEY_AND_PAYLOAD",
            "REPLAYED": "INSPECT_CANONICAL_READBACK",
            "UPLOAD_GRANT_NOT_REPLAYABLE": "INSPECT_SAME_ASSET_NEVER_REISSUE_GRANT"
          }
        },
        "x-agent-operation-id": "folder_instructions.tree.apply",
        "x-agent-operation-ids": [
          "folder_instructions.tree.apply"
        ],
        "x-sdk-methods": [
          "applyFolderInstructionTree"
        ],
        "x-cli-commands": [
          "instructions apply --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Apply folder tree",
        "description": "Apply the reviewed whole tree atomically. Requires exact preflight token, checksums, archive set, confirmLive and same retry key. Read back after an uncertain response. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable retry identity; must match body.idempotencyKey when present. Never use a fresh key after an uncertain write.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringTreeApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringTreeApplyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages/{pageId}/link": {
      "get": {
        "operationId": "getFolderInstructionPageLink",
        "x-agent-operation-id": "folder_instructions.page.link",
        "x-agent-operation-ids": [
          "folder_instructions.page.link"
        ],
        "x-sdk-methods": [
          "getFolderInstructionPageLink"
        ],
        "x-cli-commands": [
          "instructions page link --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Resolve folder page link",
        "description": "Get a current-authorized exact page link and optionally validate a stable-node anchor. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "anchor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringPageLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/verify": {
      "get": {
        "operationId": "verifyFolderInstructions",
        "x-agent-operation-id": "folder_instructions.verify",
        "x-agent-operation-ids": [
          "folder_instructions.verify"
        ],
        "x-sdk-methods": [
          "verifyFolderInstructions"
        ],
        "x-cli-commands": [
          "instructions verify --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Verify folder content",
        "description": "Verify canonical documents/tree/checksums. This does not prove real worker access, collaboration synchronization or browser rendering. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringVerifyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/search": {
      "get": {
        "operationId": "searchFolderInstructions",
        "x-agent-operation-id": "folder_instructions.search",
        "x-agent-operation-ids": [
          "folder_instructions.search"
        ],
        "x-sdk-methods": [
          "searchFolderInstructions"
        ],
        "x-cli-commands": [
          "instructions search --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Search folder Instructions",
        "description": "The employer editor’s ranked full-text search (typo-tolerant fallback) over the folder’s own draft set — exactly the pages the folder page tree lists; never a worker’s released view. Results are page groups with up to five block hits each (stable block ids for patch targets, anchor ids, the nearest heading, inert plain-text snippets with code-point highlight ranges). The cursor is bound to the folder, the query and the ranked window; truncated=true means the window filled — narrow the query instead of paging on. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringSearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/visual-review": {
      "get": {
        "operationId": "getFolderInstructionVisualReviewPlan",
        "x-agent-operation-id": "folder_instructions.visual_review",
        "x-agent-operation-ids": [
          "folder_instructions.visual_review"
        ],
        "x-sdk-methods": [
          "getFolderInstructionVisualReviewPlan"
        ],
        "x-cli-commands": [
          "instructions visual-check --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Plan folder browser review",
        "description": "Read exact employer URLs, sidebar order, checksums and visual assertions. A real authenticated browser and separate worker accounts must execute them. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringVisualReviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages/{pageId}/history": {
      "get": {
        "operationId": "listFolderInstructionPageHistory",
        "x-agent-operation-id": "folder_instructions.history.list",
        "x-agent-operation-ids": [
          "folder_instructions.history.list"
        ],
        "x-sdk-methods": [
          "listFolderInstructionPageHistory"
        ],
        "x-cli-commands": [
          "instructions history --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "List folder checkpoints",
        "description": "Read bounded page history using a page-bound cursor; no new checkpoint is created. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createFolderInstructionPageCheckpoint",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "DURABLE_RECEIPT",
          "keyRequirement": "SAME_KEY_AND_PAYLOAD",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}/history"
            }
          ],
          "identityFields": [
            "folderId",
            "idempotencyKey",
            "exactRequestPayload"
          ],
          "allowedRetryAction": "Repeat only the identical key and payload to recover the durable receipt; then inspect canonical readback. Never allocate a new key for an uncertain outcome.",
          "staleStateBehavior": "A key/payload conflict requires inspection, not a new identity or blind retry.",
          "stateActions": {
            "UNCERTAIN": "SAME_KEY_AND_PAYLOAD",
            "REPLAYED": "INSPECT_CANONICAL_READBACK",
            "UPLOAD_GRANT_NOT_REPLAYABLE": "INSPECT_SAME_ASSET_NEVER_REISSUE_GRANT"
          }
        },
        "x-agent-operation-id": "folder_instructions.history.checkpoint",
        "x-agent-operation-ids": [
          "folder_instructions.history.checkpoint"
        ],
        "x-sdk-methods": [
          "createFolderInstructionPageCheckpoint"
        ],
        "x-cli-commands": [
          "instructions history checkpoint --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Capture folder checkpoint",
        "description": "Explicitly retain current content with a retry key; unchanged content may deduplicate. Does not switch worker-visible content. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable retry identity; must match body.idempotencyKey when present. Never use a fresh key after an uncertain write.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryCheckpointRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryCheckpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages/{pageId}/history/{checkpointId}": {
      "get": {
        "operationId": "getFolderInstructionPageCheckpoint",
        "x-agent-operation-id": "folder_instructions.history.get",
        "x-agent-operation-ids": [
          "folder_instructions.history.get"
        ],
        "x-sdk-methods": [
          "getFolderInstructionPageCheckpoint"
        ],
        "x-cli-commands": [
          "instructions history show --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Read folder checkpoint",
        "description": "Read one retained immutable checkpoint after current folder/page authorization. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "checkpointId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryReadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages/{pageId}/history/{checkpointId}/compare": {
      "get": {
        "operationId": "compareFolderInstructionPageCheckpoint",
        "x-agent-operation-id": "folder_instructions.history.compare",
        "x-agent-operation-ids": [
          "folder_instructions.history.compare"
        ],
        "x-sdk-methods": [
          "compareFolderInstructionPageCheckpoint"
        ],
        "x-cli-commands": [
          "instructions history compare --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Compare folder checkpoint",
        "description": "Compare a checkpoint with current content or another checkpoint without mutation. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "checkpointId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^(current|[a-z0-9_-]+)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryCompareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages/{pageId}/history/{checkpointId}/restore": {
      "post": {
        "operationId": "restoreFolderInstructionPageCheckpoint",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "DURABLE_RECEIPT",
          "keyRequirement": "SAME_KEY_AND_PAYLOAD",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}"
            },
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}/history"
            }
          ],
          "identityFields": [
            "folderId",
            "idempotencyKey",
            "exactRequestPayload"
          ],
          "allowedRetryAction": "Repeat only the identical key and payload to recover the durable receipt; then inspect canonical readback. Never allocate a new key for an uncertain outcome.",
          "staleStateBehavior": "A key/payload conflict requires inspection, not a new identity or blind retry.",
          "stateActions": {
            "UNCERTAIN": "SAME_KEY_AND_PAYLOAD",
            "REPLAYED": "INSPECT_CANONICAL_READBACK",
            "UPLOAD_GRANT_NOT_REPLAYABLE": "INSPECT_SAME_ASSET_NEVER_REISSUE_GRANT"
          }
        },
        "x-agent-operation-id": "folder_instructions.history.restore",
        "x-agent-operation-ids": [
          "folder_instructions.history.restore"
        ],
        "x-sdk-methods": [
          "restoreFolderInstructionPageCheckpoint"
        ],
        "x-cli-commands": [
          "instructions history restore --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Restore folder checkpoint",
        "description": "Restore checked content only with current checksum and explicit live/restore confirmation; retain the pre-restore undo baseline. Retry the same key. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "checkpointId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable retry identity; must match body.idempotencyKey when present. Never use a fresh key after an uncertain write.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryRestoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryRestoreResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/pages/{pageId}/schema-upgrade": {
      "post": {
        "operationId": "runFolderInstructionSchemaUpgrade",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "PAGE_INTENT_INSPECTION",
          "keyRequirement": "NO_CLIENT_KEY",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}"
            },
            {
              "method": "POST",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages/{pageId}/schema-upgrade",
              "action": "status"
            }
          ],
          "identityFields": [
            "folderId",
            "pageId",
            "contentSchemaVersion",
            "intentId",
            "intentRevision",
            "intentStatus"
          ],
          "allowedRetryAction": "Inspect the same page schema and current intent before request/complete. Complete only a current pending intent after its drain and before expiry; never cache/replay PENDING as completion.",
          "staleStateBehavior": "Failed/expired/missing intent requires a new explicit request. Changed page or intent identity requires fresh inspection; missing intent evidence never proves completion.",
          "stateActions": {
            "PENDING": "PROGRESS_ONLY_WAIT_FOR_DRAIN",
            "COMPLETED": "VERIFY_CANONICAL_PAGE_SCHEMA",
            "FAILED": "NEW_EXPLICIT_REQUEST_REQUIRED",
            "EXPIRED": "NEW_EXPLICIT_REQUEST_REQUIRED",
            "NOT_REQUESTED": "NEW_EXPLICIT_REQUEST_REQUIRED"
          }
        },
        "x-agent-operation-id": "folder_instructions.schema_upgrade",
        "x-agent-operation-ids": [
          "folder_instructions.schema_upgrade"
        ],
        "x-sdk-methods": [
          "runFolderInstructionSchemaUpgrade"
        ],
        "x-cli-commands": [
          "instructions page upgrade-schema --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Manage folder schema upgrade",
        "description": "Use status for no-write progress. Request drains existing editors; complete swaps only stable content. Reuse this page operation; do not create a replacement page. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "pageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringSchemaUpgradeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringSchemaUpgradeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/assets/images/plan": {
      "post": {
        "operationId": "planFolderInstructionImage",
        "x-agent-operation-id": "folder_instructions.image.plan",
        "x-agent-operation-ids": [
          "folder_instructions.image.plan"
        ],
        "x-sdk-methods": [
          "planFolderInstructionImage"
        ],
        "x-cli-commands": [
          "instructions image upload --folder <folderId>",
          "instructions import docx --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Plan folder image upload",
        "description": "Preview the exact image destination and byte checksum without uploading. Pass this reviewed metadata to upload_image. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringPlanImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringPlanImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/assets/images": {
      "post": {
        "operationId": "uploadFolderInstructionImage",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "DURABLE_RECEIPT",
          "keyRequirement": "SAME_KEY_AND_PAYLOAD",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/pages"
            }
          ],
          "identityFields": [
            "folderId",
            "idempotencyKey",
            "exactRequestPayload"
          ],
          "allowedRetryAction": "Repeat only the identical key and payload to recover the durable receipt; then inspect canonical readback. Never allocate a new key for an uncertain outcome.",
          "staleStateBehavior": "A key/payload conflict requires inspection, not a new identity or blind retry.",
          "stateActions": {
            "UNCERTAIN": "SAME_KEY_AND_PAYLOAD",
            "REPLAYED": "INSPECT_CANONICAL_READBACK",
            "UPLOAD_GRANT_NOT_REPLAYABLE": "INSPECT_SAME_ASSET_NEVER_REISSUE_GRANT"
          }
        },
        "x-agent-operation-id": "folder_instructions.image.upload",
        "x-agent-operation-ids": [
          "folder_instructions.image.upload"
        ],
        "x-sdk-methods": [
          "uploadFolderInstructionImage"
        ],
        "x-cli-commands": [
          "instructions image upload --folder <folderId>",
          "instructions import docx --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Upload folder image",
        "description": "Upload at most 5 MiB of reviewed image bytes. Requires exact size/SHA256 from plan_image and confirmLive; no page edit is performed. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable retry identity; must match body.idempotencyKey when present. Never use a fresh key after an uncertain write.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "One reviewed image, at most 5 MiB. Plan exact bytes/SHA256 first."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringUploadImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/videos/prepare": {
      "post": {
        "operationId": "prepareFolderInstructionVideo",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "DURABLE_RECEIPT",
          "keyRequirement": "SAME_KEY_AND_PAYLOAD",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/videos/{assetId}"
            }
          ],
          "identityFields": [
            "folderId",
            "idempotencyKey",
            "exactRequestPayload"
          ],
          "allowedRetryAction": "Repeat only the identical key and payload to recover the durable receipt; then inspect canonical readback. Never allocate a new key for an uncertain outcome.",
          "staleStateBehavior": "A key/payload conflict requires inspection, not a new identity or blind retry.",
          "stateActions": {
            "UNCERTAIN": "SAME_KEY_AND_PAYLOAD",
            "REPLAYED": "INSPECT_CANONICAL_READBACK",
            "UPLOAD_GRANT_NOT_REPLAYABLE": "INSPECT_SAME_ASSET_NEVER_REISSUE_GRANT"
          }
        },
        "x-agent-operation-id": "folder_instructions.video.prepare",
        "x-agent-operation-ids": [
          "folder_instructions.video.prepare"
        ],
        "x-sdk-methods": [
          "prepareFolderInstructionVideo"
        ],
        "x-cli-commands": [
          "instructions video upload --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Prepare folder video upload",
        "description": "Reserve a page-bound direct TUS upload, not a document edit. The one-time grant is secret and never replayed; retry returns status/cancel recovery, not a fresh grant. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable retry identity; must match body.idempotencyKey when present. Never use a fresh key after an uncertain write.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringVideoPrepareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringVideoPrepareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/videos/{assetId}": {
      "get": {
        "operationId": "getFolderInstructionVideoStatus",
        "x-agent-operation-id": "folder_instructions.video.get",
        "x-agent-operation-ids": [
          "folder_instructions.video.get"
        ],
        "x-sdk-methods": [
          "getFolderInstructionVideoStatus"
        ],
        "x-cli-commands": [
          "instructions video status --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Read folder video status",
        "description": "Read provider readiness for a page-bound asset; may refresh readiness metadata. Does not claim playback in a browser. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringVideoStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/videos/{assetId}/cancel": {
      "post": {
        "operationId": "cancelFolderInstructionVideo",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "ASSET_IDENTITY_INSPECTION",
          "keyRequirement": "NO_CLIENT_KEY",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/videos/{assetId}"
            }
          ],
          "identityFields": [
            "folderId",
            "pageId",
            "assetId"
          ],
          "allowedRetryAction": "Inspect the same folder/page/asset. Explicitly repeat cancellation only while cancelable. Never infer cancellation from a missing asset or allocate a replacement after an uncertain provider outcome.",
          "staleStateBehavior": "READY is immutable and cannot be canceled. A missing row/404 or uncertain provider result requires reconciliation, not success.",
          "stateActions": {
            "PENDING": "EXPLICIT_SAME_ASSET_CANCEL_ALLOWED",
            "PROCESSING": "EXPLICIT_SAME_ASSET_CANCEL_ALLOWED",
            "CANCELING": "POLL_THEN_RECONCILE_SAME_ASSET",
            "CANCELED": "CANONICAL_CANCELLATION_RESPONSE_ONLY",
            "READY": "IMMUTABLE_CONFLICT",
            "UNKNOWN": "RECONCILIATION_REQUIRED",
            "NOT_FOUND": "UNKNOWN_NOT_SUCCESS"
          }
        },
        "x-agent-operation-id": "folder_instructions.video.cancel",
        "x-agent-operation-ids": [
          "folder_instructions.video.cancel"
        ],
        "x-sdk-methods": [
          "cancelFolderInstructionVideo"
        ],
        "x-cli-commands": [
          "instructions video cancel --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Cancel folder video reservation",
        "description": "Release an unfinished upload. A ready asset is immutable; canceling means provider release is pending and requires a same-asset retry. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringVideoCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringVideoCancelResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/assets/{kind}/prepare": {
      "post": {
        "operationId": "prepareFolderInstructionPrivateAsset",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "DURABLE_RECEIPT",
          "keyRequirement": "SAME_KEY_AND_PAYLOAD",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/assets/{assetId}"
            }
          ],
          "identityFields": [
            "folderId",
            "idempotencyKey",
            "exactRequestPayload"
          ],
          "allowedRetryAction": "Repeat only the identical key and payload to recover the durable receipt; then inspect canonical readback. Never allocate a new key for an uncertain outcome.",
          "staleStateBehavior": "A key/payload conflict requires inspection, not a new identity or blind retry.",
          "stateActions": {
            "UNCERTAIN": "SAME_KEY_AND_PAYLOAD",
            "REPLAYED": "INSPECT_CANONICAL_READBACK",
            "UPLOAD_GRANT_NOT_REPLAYABLE": "INSPECT_SAME_ASSET_NEVER_REISSUE_GRANT"
          }
        },
        "x-agent-operation-id": "folder_instructions.asset.prepare",
        "x-agent-operation-ids": [
          "folder_instructions.asset.prepare"
        ],
        "x-sdk-methods": [
          "prepareFolderInstructionPrivateAsset"
        ],
        "x-cli-commands": [
          "instructions asset upload --folder <folderId>",
          "instructions asset prepare --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Prepare folder private asset upload",
        "description": "Reserve a page-bound private AUDIO (audio/mpeg|mp4|ogg|wav, ≤ 50 MiB) or FILE attachment (pdf/docx/xlsx/csv/txt, ≤ 25 MiB) upload, not a document edit. The one-time signed PUT URL is secret and never replayed: PUT the bytes there with exactly upload.contentType, then asset_finalize and insert the returned node on a schema-v2 page. Retry returns status/cancel recovery, not a fresh URL. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable retry identity; must match body.idempotencyKey when present. Never use a fresh key after an uncertain write.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringAssetPrepareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringAssetPrepareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/assets/{assetId}": {
      "get": {
        "operationId": "getFolderInstructionPrivateAsset",
        "x-agent-operation-id": "folder_instructions.asset.get",
        "x-agent-operation-ids": [
          "folder_instructions.asset.get"
        ],
        "x-sdk-methods": [
          "getFolderInstructionPrivateAsset"
        ],
        "x-cli-commands": [
          "instructions asset status --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:read"
        ],
        "summary": "Read folder private asset status",
        "description": "Read a private audio / file attachment asset bound to this folder set: PENDING (awaiting bytes or finalize), READY (verified and served at url) or ERRORED (terminal), with the exact node to insert. Video assets are read with video_status. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringAssetStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/assets/{assetId}/finalize": {
      "post": {
        "operationId": "finalizeFolderInstructionPrivateAsset",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "ASSET_IDENTITY_INSPECTION",
          "keyRequirement": "NO_CLIENT_KEY",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/assets/{assetId}"
            }
          ],
          "identityFields": [
            "folderId",
            "pageId",
            "assetId"
          ],
          "allowedRetryAction": "Inspect the same folder/page/asset. Finalize is convergent: repeat it for the same asset after the PUT completed; a READY asset returns the same result. Never allocate a replacement after an uncertain outcome.",
          "staleStateBehavior": "READY is immutable and cannot be canceled. A missing row/404 or uncertain provider result requires reconciliation, not success.",
          "stateActions": {
            "PENDING": "EXPLICIT_SAME_ASSET_CANCEL_ALLOWED",
            "PROCESSING": "EXPLICIT_SAME_ASSET_CANCEL_ALLOWED",
            "CANCELING": "POLL_THEN_RECONCILE_SAME_ASSET",
            "CANCELED": "CANONICAL_CANCELLATION_RESPONSE_ONLY",
            "READY": "IMMUTABLE_CONFLICT",
            "UNKNOWN": "RECONCILIATION_REQUIRED",
            "NOT_FOUND": "UNKNOWN_NOT_SUCCESS"
          }
        },
        "x-agent-operation-id": "folder_instructions.asset.finalize",
        "x-agent-operation-ids": [
          "folder_instructions.asset.finalize"
        ],
        "x-sdk-methods": [
          "finalizeFolderInstructionPrivateAsset"
        ],
        "x-cli-commands": [
          "instructions asset upload --folder <folderId>",
          "instructions asset finalize --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Finalize folder private asset upload",
        "description": "After the PUT completed: the server sniffs the stored bytes against the declared type, bounds the size and marks the asset READY, returning the delivery url and the node to insert. Convergent — an already-READY asset returns the same; an expired PENDING upload fails (prepare again). Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringAssetFinalizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringAssetFinalizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/instructions/folders/{folderId}/assets/{assetId}/cancel": {
      "post": {
        "operationId": "cancelFolderInstructionPrivateAsset",
        "x-opentrain-authoring-retry": {
          "schemaVersion": "folder-instruction-authoring-retry/1",
          "automaticRetry": false,
          "missingResourceBehavior": "UNKNOWN_NOT_SUCCESS",
          "policy": "ASSET_IDENTITY_INSPECTION",
          "keyRequirement": "NO_CLIENT_KEY",
          "inspect": [
            {
              "method": "GET",
              "path": "/api/public/v1/instructions/folders/{folderId}/assets/{assetId}"
            }
          ],
          "identityFields": [
            "folderId",
            "pageId",
            "assetId"
          ],
          "allowedRetryAction": "Inspect the same folder/page/asset. Explicitly repeat cancellation only while cancelable. Never infer cancellation from a missing asset or allocate a replacement after an uncertain provider outcome.",
          "staleStateBehavior": "READY is immutable and cannot be canceled. A missing row/404 or uncertain provider result requires reconciliation, not success.",
          "stateActions": {
            "PENDING": "EXPLICIT_SAME_ASSET_CANCEL_ALLOWED",
            "PROCESSING": "EXPLICIT_SAME_ASSET_CANCEL_ALLOWED",
            "CANCELING": "POLL_THEN_RECONCILE_SAME_ASSET",
            "CANCELED": "CANONICAL_CANCELLATION_RESPONSE_ONLY",
            "READY": "IMMUTABLE_CONFLICT",
            "UNKNOWN": "RECONCILIATION_REQUIRED",
            "NOT_FOUND": "UNKNOWN_NOT_SUCCESS"
          }
        },
        "x-agent-operation-id": "folder_instructions.asset.cancel",
        "x-agent-operation-ids": [
          "folder_instructions.asset.cancel"
        ],
        "x-sdk-methods": [
          "cancelFolderInstructionPrivateAsset"
        ],
        "x-cli-commands": [
          "instructions asset cancel --folder <folderId>"
        ],
        "x-required-scopes": [
          "instructions:write"
        ],
        "summary": "Cancel folder private asset upload",
        "description": "Release a PENDING private audio / file upload you prepared. \"canceled\" confirms the release; \"ready\" means the asset was finalized first and stays (READY assets are never deleted). Convergent. Requires current employer folder access. Empty destinations require reviewed activation; published/unknown delivery writes refuse without changing release/read/ack flags.",
        "tags": [
          "Instructions"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderInstructionAuthoringAssetCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical result. REST readback is not browser, worker or provider playback proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FolderInstructionAuthoringAssetCancelResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or invalid input, confirmation or retry identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, verified actor or current employer access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Folder, page, checkpoint or asset unavailable to the actor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale preflight/checksum, writer fence, first-activation requirement or incompatible published/unknown delivery. Inspect current state; do not blindly repeat with a new identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Bounded document, tree or asset input exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/send-plans": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "createAgreementSendPlan",
        "summary": "Set up a signing to-do before its fields are placed",
        "description": "Scopes agreements:write and project_todos:write; the agreements agent surface (AGENT_SURFACE_AGREEMENTS_ENABLED) and the agreements_native rollout; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. action \"preflight\" writes nothing and returns each job's masked recipients plus a signed 15-minute receipt (the same preflight serves PATCH /agreements/send-plans/{sendPlanId}). action \"create\" stores the send plan on a native document whose PDF is uploaded and needs that receipt, confirmLive, yes and an Idempotency-Key header; it returns sendPlan.placeFieldsUrl. Nothing is sent until the employer saves on that page; an unsaved plan expires after 7 days. One plan per document.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Required for action \"create\"; ignored for \"preflight\". Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementSendPlanCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preflight, or an idempotent replay of a create",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementSendPlanCreateResponse"
                }
              }
            }
          },
          "201": {
            "description": "Set up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementSendPlanCreateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, RECIPIENT_NOT_ELIGIBLE or INVALID_DEADLINE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "TENANT_ACCESS_DENIED, AGREEMENTS_DISABLED or a missing scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Document not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "SEND_PLAN_EXISTS, PREFLIGHT_RECEIPT_EXPIRED / _STALE / _INVALID, AGREEMENTS_NOT_CONFIGURED, PROJECT_TODOS_DISABLED, or an idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/send-plans/{sendPlanId}": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "getAgreementSendPlan",
        "summary": "Get a send plan",
        "description": "Scope agreements:read; the agreements agent surface (AGENT_SURFACE_AGREEMENTS_ENABLED) and the agreements_native rollout. Status, fieldsPlaced, placeFieldsUrl, the confirmed recipient counts and, once SENT, the to-do ids, recipientCount and the live requestCount. A plan past its 7 days without a save reads EXPIRED.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sendPlanId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Send plan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementSendPlanEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "agreements"
        ],
        "operationId": "updateAgreementSendPlan",
        "summary": "Replace a send plan with a newly confirmed one",
        "description": "Scopes agreements:write and project_todos:write; the agreements agent surface (AGENT_SURFACE_AGREEMENTS_ENABLED) and the agreements_native rollout; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Run POST /agreements/send-plans with action \"preflight\" for the new plan first. Allowed while WAITING_FOR_FIELDS, NEEDS_CONFIRM or EXPIRED; the plan is armed again for 7 days. From NEEDS_CONFIRM the employer already saved, so the confirmed plan is sent now.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sendPlanId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementSendPlanUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated (or an idempotent replay)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementSendPlanWriteResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, RECIPIENT_NOT_ELIGIBLE or INVALID_DEADLINE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "TENANT_ACCESS_DENIED, AGREEMENTS_DISABLED or a missing scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "SEND_PLAN_CLOSED, REVISION_CONFLICT, PREFLIGHT_RECEIPT_EXPIRED / _STALE / _INVALID, or an idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/send-plans/{sendPlanId}/cancel": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "cancelAgreementSendPlan",
        "summary": "Cancel a send plan that has not been sent",
        "description": "Scope agreements:write; the agreements agent surface (AGENT_SURFACE_AGREEMENTS_ENABLED) and the agreements_native rollout. An unsent plan becomes CANCELLED and the place page will not send it; repeating returns the same answer. A SENT plan is 409 SEND_PLAN_CLOSED.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "sendPlanId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementSendPlanCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancelled (or an idempotent replay)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementSendPlanWriteResult"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "SEND_PLAN_CLOSED, REVISION_CONFLICT or an idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/recipients": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "listAgreementRecipients",
        "summary": "List one job's people for a SELECTED plan",
        "description": "Scope agreements:read; the agreements agent surface (AGENT_SURFACE_AGREEMENTS_ENABLED) and the agreements_native rollout. One job's current people as contractId and masked \"First L.\" displayName, never an email: the names an employer gives become contract ids for audience SELECTED. At most 500 (totalCount and truncated say when there are more).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recipients",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRecipientListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "TENANT_ACCESS_DENIED, AGREEMENTS_DISABLED or a missing scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/documents": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "listAgreementDocuments",
        "summary": "List agreement documents",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. Newest first; pass nextCursor back as cursor.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Documents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementDocumentList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid cursor or limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "createAgreementDocument",
        "summary": "Create an agreement document",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Creates the draft metadata; upload the PDF with uploads/prepare, a signed PUT and uploads/finalize.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementDocumentCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementDocumentCreateResponse"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementDocumentCreateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "DOCUMENT_KEY_TAKEN or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "DOCUMENT_TYPE_UNSUPPORTED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/documents/{documentId}": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "getAgreementDocument",
        "summary": "Get an agreement document",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementDocumentEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/documents/uploads/prepare": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "prepareAgreementDocumentUpload",
        "summary": "Reserve a PDF upload",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Replaces the draft source (status PENDING) at expectedRevision and returns a signed PUT; a replay returns a fresh PUT for the same reservation.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementUploadPrepareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload reserved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementUploadPrepareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "REVISION_CONFLICT or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "DOCUMENT_TOO_LARGE (sizeBytes over the limit; details.maxBytes)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "DOCUMENT_TYPE_UNSUPPORTED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Direct upload temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/documents/uploads/finalize": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "finalizeAgreementDocumentUpload",
        "summary": "Verify the uploaded PDF",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Hashes and parses the stored bytes on the server; clears placed fields because the source changed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementUploadFinalizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Source ready",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementUploadFinalizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_INCOMPLETE, UPLOAD_REQUIRED, CHECKSUM_MISMATCH or REVISION_CONFLICT",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "DOCUMENT_TOO_LARGE (the stored bytes are over the limit; details.maxBytes)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "DOCUMENT_TYPE_UNSUPPORTED (not a readable PDF or too many pages)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/documents/{documentId}/fields": {
      "put": {
        "tags": [
          "agreements"
        ],
        "operationId": "setAgreementDocumentFields",
        "summary": "Place the document’s fields",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Replaces the field set at expectedRevision; placement warnings come back typed and must be resolved or waived before publish.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementFieldsSetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fields placed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementFieldsSetResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_REQUIRED, REVISION_CONFLICT or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/documents/{documentId}/preview": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "previewAgreementDocument",
        "summary": "Preview draft pages",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. Renders page PNGs with labelled field boxes and returns short-lived resource handles; without pages, page 1 and every page with a field (at most 10).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "pages",
            "in": "query",
            "required": false,
            "description": "Comma-separated page numbers (at most 10).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementPreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "PAGE_OUT_OF_RANGE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/documents/{documentId}/publish": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "publishAgreementDocument",
        "summary": "Publish an immutable version",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Freezes the verified PDF, page geometry and canonical field manifest into a new version; blocks on unwaived placement warnings.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementPublishRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementPublishResponse"
                }
              }
            }
          },
          "201": {
            "description": "Published",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementPublishResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_REQUIRED, REVISION_CONFLICT or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "PUBLISH_WARNINGS_UNWAIVED or REQUIRED_FIELD_MISSING",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/versions/{versionId}/project-todos": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "attachAgreementVersionToProjectTodos",
        "summary": "Attach a published agreement to Project To-dos",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Also needs scope project_todos:write and Project To-dos enabled on every job. action \"preflight\" writes nothing and returns each job's masked recipients plus a signed 15-minute receipt; action \"attach\" needs that receipt, confirmLive and yes, and an Idempotency-Key header, and creates one To-do per job and one native signing request per assignment (future hires are added as they join when the audience includes them).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "versionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Required for action \"attach\"; ignored for \"preflight\". Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementAttachRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preflight, or an idempotent replay of an attach",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementAttachResponse"
                }
              }
            }
          },
          "201": {
            "description": "Attached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementAttachResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, RECIPIENT_NOT_ELIGIBLE or INVALID_DEADLINE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "TENANT_ACCESS_DENIED, AGREEMENTS_DISABLED or a missing scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Version not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "PREFLIGHT_RECEIPT_EXPIRED / _STALE / _INVALID, PROJECT_TODOS_DISABLED, or an idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/requests": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "listAgreementRequests",
        "summary": "List signing requests",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. The organization's signing requests of both providers (OpenTrain-native and legacy Dropbox Sign), newest first; pass nextCursor back as cursor. jobId lists a job's roster, contractId one worker's agreements on a contract (ICA, confidentiality agreement and project assignment are separate requests), provider narrows to one runtime. Each row carries the executed document's SHA-256 when the exact signed PDF is stored. Signers appear as a masked \"First L.\" name only.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPENTRAIN",
                "DROPBOX_SIGN"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "QUEUED",
                "SENT",
                "VIEWED",
                "CONSENTED",
                "SIGNED",
                "COMPLETED",
                "DECLINED",
                "VOIDED",
                "FAILED",
                "EXPIRED",
                "RETRYING",
                "SENDING",
                "PENDING",
                "SIGNED_PENDING_FILES",
                "CANCELLED",
                "ERROR"
              ]
            }
          },
          {
            "name": "versionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Signing requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequestList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid cursor, limit, provider or status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/requests/{requestId}": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "getAgreementRequest",
        "summary": "Get a signing request",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. One request of either provider: provider, status, timestamps, the masked signer, the executed document's SHA-256 and size, and (native only; null for Dropbox Sign) the evidence chain's length and head hash.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(native|dropbox_sign):[A-Za-z0-9_-]{1,64}$",
              "description": "native:<id> (the value attach returned for an OpenTrain-executed request) or dropbox_sign:<id> (a legacy Dropbox Sign envelope); the prefix is the provider."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Signing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequestEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/requests/{requestId}/remind": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "remindAgreementRequest",
        "summary": "Remind a signer",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Sends the signer one reminder through the Project To-do notifications and records it on the evidence chain. One reminder per request per hour: a second call is 429 RATE_LIMITED with details.detail REMIND_COOLDOWN and details.retryAfterSeconds. Until in-app signing is available every call is 409 REQUEST_NOT_READY (\"signing is not available yet\") and nothing is written.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^native:[A-Za-z0-9_-]{1,64}$",
              "description": "The native:<id> value attach returned for the request (Dropbox Sign requests have no OpenTrain evidence chain or reminders)."
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequestRemindResponse"
                }
              }
            }
          },
          "201": {
            "description": "Reminded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequestRemindResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "REQUEST_NOT_READY (signing not available yet, not sent, or closed) or an idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED (REMIND_COOLDOWN, retryAfterSeconds)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/requests/{requestId}/void": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "voidAgreementRequest",
        "summary": "Void a signing request",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Withdraws one native request and closes the person's agreement To-do. The request becomes VOIDED, its unused signing link retires and a chained REQUEST_VOIDED event (with the reason) is appended; nothing is deleted. A SIGNED or COMPLETED request stands, and an already VOIDED one is refused: 409 REQUEST_NOT_READY with details.status. Needs confirmLive: true.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^native:[A-Za-z0-9_-]{1,64}$",
              "description": "The native:<id> value attach returned for the request (Dropbox Sign requests have no OpenTrain evidence chain or reminders)."
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementRequestVoidRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequestVoidResponse"
                }
              }
            }
          },
          "201": {
            "description": "Voided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequestVoidResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request id or body (confirmLive must be true)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found, outside the organization, or not a native request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "REQUEST_NOT_READY (signed, completed or already void) or an idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/webhooks": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "listAgreementWebhooks",
        "summary": "List agreement webhooks",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. The caller's webhook subscriptions that carry at least one agreement.* event type, newest first (a personal token sees personal subscriptions, an organization token that organization's). No secret, hash or prefix is ever returned. previousSignatureUntil shows an open rotation grace period.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Agreement webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementWebhookListResponse"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/webhooks/{webhookId}/rotate": {
      "post": {
        "tags": [
          "agreements"
        ],
        "operationId": "rotateAgreementWebhook",
        "summary": "Rotate an agreement webhook secret",
        "description": "Scope agreements:write; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token; the organization owner or a member authorized for e-signature. Domain failures carry the agent-contract code in details.reason. Replaces the signing secret of one subscription that carries agreement.* events and returns the new one once. For 24 hours each delivery carries two v1 signatures (new and old) in X-OpenTrain-Signature; verify against any v1. A second rotation inside that window keeps the oldest secret and its end time. Every subscribed event type must still be readable by the token. REST, SDK and CLI only: there is no MCP tool. Needs confirmLive: true.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon. The same key with the same payload replays the durable receipt; the same key with a different payload is 409 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgreementWebhookRotateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay; secret is null",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementWebhookRotateResponse"
                }
              }
            }
          },
          "201": {
            "description": "Rotated; the answer holds the new secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementWebhookRotateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid webhook id or body (confirmLive must be true)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate, or an event type the token cannot read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found, not the caller's, or carries no agreement.* event type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/requests/{requestId}/download": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "downloadAgreementRequest",
        "summary": "Download a sealed artifact",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. One artifact of a signing request: the signed PDF, its certificate of completion, the RFC 3161 timestamp token (DER TimeStampToken; verify with openssl ts -verify -token_in) or the version's base PDF (source). The first three exist once the request is COMPLETED (409 ARTIFACT_NOT_SEALED before). A Dropbox Sign request (dropbox_sign:<id>) has signed only — the exact executed PDF the provider returned, never a regenerated document; its other artifacts are 404 ARTIFACT_NOT_FOUND with details.provider. The bytes are re-hashed before anything is returned. delivery=handle (default) answers a 10-minute private resource handle, fetched from GET /agreements/resources/{resourceId}; delivery=file streams the bytes with x-content-sha256. Every handle minted and file delivered is recorded in the organization's audit log (AGREEMENT_ARTIFACTS).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(native|dropbox_sign):[A-Za-z0-9_-]{1,64}$",
              "description": "native:<id> (the value attach returned for an OpenTrain-executed request) or dropbox_sign:<id> (a legacy Dropbox Sign envelope); the prefix is the provider."
            }
          },
          {
            "name": "artifact",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "signed",
                "certificate",
                "timestamp",
                "source"
              ]
            }
          },
          {
            "name": "delivery",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "handle",
                "file"
              ],
              "default": "handle"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A resource handle (delivery=handle) or the artifact bytes (delivery=file)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementDownloadResponse"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/timestamp-reply": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request id, artifact or delivery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization (ARTIFACT_NOT_FOUND for a missing artifact)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "ARTIFACT_NOT_SEALED, or SEAL_VALIDATION_FAILED when stored bytes fail their hash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/requests/{requestId}/audit": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "auditAgreementRequest",
        "summary": "Read the verified evidence record",
        "description": "Scopes agreements:read AND agreements_audit:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. The evidence record of a native signing request (native:<id> only; a Dropbox Sign request's audit trail is inside its executed PDF), recomputed on read: the evidence-chain events (re-verified), every artifact's SHA-256 (bytes re-read and re-hashed), the RFC 3161 timestamp (re-verified against the signed PDF) and the consent text version. Never IP addresses, user agents, emails, field values or storage keys. Downloads are not part of the chain.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^native:[A-Za-z0-9_-]{1,64}$",
              "description": "The native:<id> value attach returned for the request (Dropbox Sign requests have no OpenTrain evidence chain or reminders)."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Evidence record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementRequestAudit"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope (agreements_audit:read), rollout or organization gate",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agreements/resources/{resourceId}": {
      "get": {
        "tags": [
          "agreements"
        ],
        "operationId": "getAgreementResource",
        "summary": "Fetch a resource handle’s bytes",
        "description": "Scope agreements:read; the `agreements_native` rollout for the caller (403 FORBIDDEN, details.reason AGREEMENTS_DISABLED) and an employer organization token. Returns the bytes behind a resource handle after re-authorizing the caller: the PNG behind a preview handle (agp_), or a sealed artifact behind a download handle (agd_) re-verified against its SHA-256 (x-content-sha256). Fetching a download handle is not audited again; its mint was.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PNG, PDF or timestamp-token bytes",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/timestamp-reply": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Unknown, expired or outside the organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/retraining/cases": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "createLmsRetrainingCase",
        "summary": "Create a DRAFT individualized retraining case for one worker",
        "description": "Requires `lms:write` and `Idempotency-Key`. Creates a DRAFT case for EXACTLY ONE worker on one job, resolved fail-closed from `worker.contractId` or an exact `worker.workerName` (ambiguity is a 409). The capture carries EXACTLY ONE due channel: `dueOffsetMinutes` XOR `absoluteDue` {localDate, localTime, timeZone} — never both, never neither. A REPEATED occurrence must cite its CLOSED prior case. Employer-private capture (observedMistake, hidden evidence, source refs) never reaches the worker; worker names stay masked. Same-key replays of the identical capture return the original case.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "jobId",
                  "worker",
                  "observedMistake",
                  "expectedBehavior",
                  "workerSummary",
                  "mode"
                ],
                "properties": {
                  "jobId": {
                    "type": "string"
                  },
                  "worker": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Exactly one of contractId or workerName.",
                    "properties": {
                      "contractId": {
                        "type": "string"
                      },
                      "workerName": {
                        "type": "string",
                        "maxLength": 200
                      }
                    }
                  },
                  "observedMistake": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "expectedBehavior": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "workerSummary": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "specialization": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  },
                  "sourceKind": {
                    "type": "string",
                    "enum": [
                      "MANUAL",
                      "FEEDBACK_REPORT",
                      "OPEN_LABEL_REVIEW",
                      "TASK"
                    ],
                    "default": "MANUAL"
                  },
                  "sourceRef": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  },
                  "occurrenceKind": {
                    "type": "string",
                    "enum": [
                      "FIRST",
                      "REPEATED"
                    ],
                    "default": "FIRST"
                  },
                  "priorCaseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "evidence": {
                    "type": "array",
                    "maxItems": 25,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "kind",
                        "value"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "NOTE",
                            "LINK",
                            "FILE",
                            "OPEN_LABEL_TASK"
                          ]
                        },
                        "value": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "workerVisible": {
                          "type": "boolean",
                          "default": false
                        }
                      }
                    }
                  },
                  "instructionRefs": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string"
                    }
                  },
                  "contentPlan": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "learningObjectives",
                          "lessonOutline",
                          "finalAssessmentBrief"
                        ],
                        "properties": {
                          "learningObjectives": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 50,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            }
                          },
                          "lessonOutline": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 50,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            }
                          },
                          "practiceBriefs": {
                            "type": "array",
                            "maxItems": 50,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            }
                          },
                          "formativeQuestionBriefs": {
                            "type": "array",
                            "maxItems": 50,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            }
                          },
                          "finalAssessmentBrief": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "intent",
                              "passingRequirement"
                            ],
                            "properties": {
                              "intent": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000
                              },
                              "passingRequirement": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000
                              },
                              "passThresholdPercent": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          }
                        }
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Employer-only typed authoring brief; never worker-visible."
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "MASTERY",
                      "EMPLOYER_REVIEW"
                    ]
                  },
                  "courseId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "moduleKey": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "masteryRunLimit": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10
                  },
                  "masteryAntiGuessPolicy": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "schemaVersion",
                          "cooldownStepsSeconds",
                          "restartScope"
                        ],
                        "properties": {
                          "schemaVersion": {
                            "type": "integer",
                            "enum": [
                              1
                            ]
                          },
                          "cooldownStepsSeconds": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 10,
                            "items": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 3600
                            }
                          },
                          "restartScope": {
                            "type": "string",
                            "enum": [
                              "WHOLE_MODULE",
                              "MISSED_QUESTIONS"
                            ]
                          }
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dueOffsetMinutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 525600,
                    "description": "Relative due in minutes, frozen to one instant at plan time. EXACTLY ONE due channel per case: dueOffsetMinutes XOR absoluteDue, never both and never neither (both or neither refuses). Null clears a channel, so a patch that switches channels sets one and nulls the other."
                  },
                  "absoluteDue": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "localDate",
                          "localTime",
                          "timeZone"
                        ],
                        "properties": {
                          "localDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "localTime": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timeZone": {
                            "type": "string",
                            "maxLength": 80
                          }
                        }
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Wall-clock due {localDate, localTime, timeZone}, resolved fail-closed against real IANA zones and DST at plan time. EXACTLY ONE due channel per case: dueOffsetMinutes XOR absoluteDue, never both and never neither (both or neither refuses). Null clears a channel, so a patch that switches channels sets one and nulls the other."
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "NORMAL",
                      "HIGH",
                      "URGENT"
                    ],
                    "default": "URGENT"
                  },
                  "required": {
                    "type": "boolean",
                    "default": true
                  },
                  "blockingMode": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "IMMEDIATE",
                      "AFTER_DUE"
                    ],
                    "default": "IMMEDIATE"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created retraining case with live canonical projections",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "case",
                    "worker",
                    "assignment",
                    "review",
                    "runs",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "case": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "organizationId",
                        "jobId",
                        "contractId",
                        "workerUserId",
                        "createdByUserId",
                        "sourceKind",
                        "sourceRef",
                        "observedMistake",
                        "expectedBehavior",
                        "workerSummary",
                        "specialization",
                        "occurrenceKind",
                        "priorCaseId",
                        "evidence",
                        "instructionRefs",
                        "contentPlan",
                        "mode",
                        "courseId",
                        "moduleKey",
                        "masteryRunLimit",
                        "masteryAntiGuessPolicy",
                        "dueOffsetMinutes",
                        "absoluteDue",
                        "priority",
                        "required",
                        "blockingMode",
                        "status",
                        "closedOutcome",
                        "closedReason",
                        "closedAt",
                        "assignmentId",
                        "bindingId",
                        "live",
                        "stateRevision",
                        "createdAt",
                        "updatedAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "contractId": {
                          "type": "string"
                        },
                        "workerUserId": {
                          "type": "string"
                        },
                        "createdByUserId": {
                          "type": "string"
                        },
                        "sourceKind": {
                          "type": "string",
                          "enum": [
                            "MANUAL",
                            "FEEDBACK_REPORT",
                            "OPEN_LABEL_REVIEW",
                            "TASK"
                          ]
                        },
                        "sourceRef": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "observedMistake": {
                          "type": "string"
                        },
                        "expectedBehavior": {
                          "type": "string"
                        },
                        "workerSummary": {
                          "type": "string"
                        },
                        "specialization": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "occurrenceKind": {
                          "type": "string",
                          "enum": [
                            "FIRST",
                            "REPEATED"
                          ]
                        },
                        "priorCaseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "evidence": {
                          "type": "array",
                          "maxItems": 25,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "value"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "NOTE",
                                  "LINK",
                                  "FILE",
                                  "OPEN_LABEL_TASK"
                                ]
                              },
                              "value": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "workerVisible": {
                                "type": "boolean",
                                "default": false
                              }
                            }
                          }
                        },
                        "instructionRefs": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string"
                          }
                        },
                        "contentPlan": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "learningObjectives",
                                "lessonOutline",
                                "finalAssessmentBrief"
                              ],
                              "properties": {
                                "learningObjectives": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "lessonOutline": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "practiceBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "formativeQuestionBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "finalAssessmentBrief": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "intent",
                                    "passingRequirement"
                                  ],
                                  "properties": {
                                    "intent": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passingRequirement": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passThresholdPercent": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0,
                                      "maximum": 100
                                    }
                                  }
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "MASTERY",
                            "EMPLOYER_REVIEW"
                          ]
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "moduleKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "masteryRunLimit": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10
                        },
                        "masteryAntiGuessPolicy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "schemaVersion",
                                "cooldownStepsSeconds",
                                "restartScope"
                              ],
                              "properties": {
                                "schemaVersion": {
                                  "type": "integer",
                                  "enum": [
                                    1
                                  ]
                                },
                                "cooldownStepsSeconds": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 10,
                                  "items": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 3600
                                  }
                                },
                                "restartScope": {
                                  "type": "string",
                                  "enum": [
                                    "WHOLE_MODULE",
                                    "MISSED_QUESTIONS"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dueOffsetMinutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 525600
                        },
                        "absoluteDue": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "localDate",
                                "localTime",
                                "timeZone"
                              ],
                              "properties": {
                                "localDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "localTime": {
                                  "type": "string",
                                  "pattern": "^\\d{2}:\\d{2}$"
                                },
                                "timeZone": {
                                  "type": "string",
                                  "maxLength": 80
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priority": {
                          "type": "string",
                          "enum": [
                            "NORMAL",
                            "HIGH",
                            "URGENT"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "blockingMode": {
                          "type": "string",
                          "enum": [
                            "NONE",
                            "IMMEDIATE",
                            "AFTER_DUE"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "ASSIGNED",
                            "CLOSED"
                          ]
                        },
                        "closedOutcome": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "PASSED",
                                "FAILED",
                                "CANCELLED",
                                "SUPERSEDED"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "closedReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "closedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "bindingId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "live": {
                          "description": "Live projection joined from the CANONICAL assignment row at read time (get/list); the case never stores a second copy of training state.",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "assignmentStatus",
                                "waitingOnRole",
                                "assignedAt",
                                "dueAt",
                                "submittedAt",
                                "completedAt"
                              ],
                              "properties": {
                                "assignmentStatus": {
                                  "type": "string"
                                },
                                "waitingOnRole": {
                                  "type": "string"
                                },
                                "assignedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "dueAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "submittedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "completedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "stateRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "worker": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "contractId",
                        "displayName"
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked — \"First L.\" only."
                        }
                      }
                    },
                    "assignment": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/LmsAssignmentRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "review": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "assignmentStatus",
                            "waitingOnRole",
                            "submittedAt",
                            "completionPolicy",
                            "returnGrants",
                            "canReturn",
                            "workerName",
                            "courseTitle",
                            "lessons",
                            "links"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "assignmentStatus": {
                              "type": "string"
                            },
                            "waitingOnRole": {
                              "type": "string"
                            },
                            "submittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "SYSTEM",
                                "EMPLOYER_REVIEW"
                              ]
                            },
                            "returnGrants": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "canReturn": {
                              "type": "boolean"
                            },
                            "workerName": {
                              "type": "string"
                            },
                            "courseTitle": {
                              "type": "string"
                            },
                            "lessons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "lessonTitle",
                                  "status",
                                  "reviewReason",
                                  "manualReview",
                                  "attempt",
                                  "reviewTarget",
                                  "projection",
                                  "retry",
                                  "attemptHistory",
                                  "responseQuestions"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "lessonTitle": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "reviewReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "manualReview": {
                                    "type": "boolean"
                                  },
                                  "attempt": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "id",
                                      "number",
                                      "submittedAt",
                                      "formTitle",
                                      "resultReleasedAt"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "integer",
                                        "minimum": 1
                                      },
                                      "submittedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "formTitle": {
                                        "type": "string"
                                      },
                                      "resultReleasedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      }
                                    }
                                  },
                                  "reviewTarget": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "assignmentId",
                                          "lessonKey",
                                          "attemptId",
                                          "assessmentId",
                                          "courseVersionId",
                                          "releaseId",
                                          "formVersionId",
                                          "targetHash",
                                          "latestAttemptId",
                                          "isLatestAttempt"
                                        ],
                                        "properties": {
                                          "assignmentId": {
                                            "type": "string"
                                          },
                                          "lessonKey": {
                                            "type": "string"
                                          },
                                          "attemptId": {
                                            "type": "string"
                                          },
                                          "assessmentId": {
                                            "type": "string"
                                          },
                                          "courseVersionId": {
                                            "type": "string"
                                          },
                                          "releaseId": {
                                            "type": "string"
                                          },
                                          "formVersionId": {
                                            "type": "string"
                                          },
                                          "targetHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          },
                                          "latestAttemptId": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "isLatestAttempt": {
                                            "type": "boolean"
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "projection": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "earnedPoints",
                                          "possiblePoints",
                                          "passed"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string"
                                          },
                                          "earnedPoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "possiblePoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "passed": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "retry": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "canRetry",
                                          "exhausted",
                                          "attemptCount",
                                          "maxAttempts",
                                          "returnGrants"
                                        ],
                                        "properties": {
                                          "canRetry": {
                                            "type": "boolean"
                                          },
                                          "exhausted": {
                                            "type": "boolean"
                                          },
                                          "attemptCount": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "maxAttempts": {
                                            "type": [
                                              "integer",
                                              "null"
                                            ],
                                            "minimum": 1
                                          },
                                          "returnGrants": {
                                            "type": "integer",
                                            "minimum": 0
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "attemptHistory": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "id",
                                        "number",
                                        "status",
                                        "submittedAt",
                                        "resultReleasedAt",
                                        "projection"
                                      ],
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "number": {
                                          "type": "integer",
                                          "minimum": 1
                                        },
                                        "status": {
                                          "type": "string"
                                        },
                                        "submittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "resultReleasedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "projection": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "state",
                                                "earnedPoints",
                                                "possiblePoints",
                                                "passed"
                                              ],
                                              "properties": {
                                                "state": {
                                                  "type": "string"
                                                },
                                                "earnedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "possiblePoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "passed": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "responseQuestions": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "questionId",
                                        "prompt",
                                        "answer",
                                        "responseText",
                                        "manualMaxPoints",
                                        "grade",
                                        "currentManualGrade"
                                      ],
                                      "properties": {
                                        "questionId": {
                                          "type": "string"
                                        },
                                        "prompt": {
                                          "type": "string"
                                        },
                                        "answer": {
                                          "description": "Immutable raw stored Native Forms answer value (string, number, boolean, string array, or null). Never a correct answer or key."
                                        },
                                        "responseText": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "manualMaxPoints": {
                                          "type": [
                                            "number",
                                            "null"
                                          ]
                                        },
                                        "grade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "correct",
                                                "awardedPoints",
                                                "maxPoints",
                                                "manuallyGraded"
                                              ],
                                              "properties": {
                                                "correct": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                },
                                                "awardedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "manuallyGraded": {
                                                  "type": "boolean"
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "currentManualGrade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "awardedPoints",
                                                "maxPoints",
                                                "reason"
                                              ],
                                              "properties": {
                                                "awardedPoints": {
                                                  "type": "number"
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "reason": {
                                                  "type": [
                                                    "string",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "links": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/LmsCanonicalLink"
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "runs": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "items",
                            "nextCursor",
                            "hasMore"
                          ],
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "runNumber",
                                  "status",
                                  "startedAt",
                                  "submittedAt",
                                  "wrongCount",
                                  "unansweredCount"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "runNumber": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "startedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "wrongCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "unansweredCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  }
                                }
                              }
                            },
                            "nextCursor": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "hasMore": {
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Request validation failed, including a due-channel violation (both or neither of dueOffsetMinutes/absoluteDue)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job, worker, or prior case not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Ambiguous worker name, duplicate open occurrence/source, prior case not closed, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Due channel violation (exactly one of absoluteDue/dueOffsetMinutes), invalid zone/date/DST-nonexistent time, or unknown module",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsRetrainingCases",
        "summary": "List retraining cases (masked workers, explicit hasMore)",
        "description": "Requires `lms:read` plus per-job member access. Cursor-paged in one stable order with an explicit `hasMore` — a truncated read is never mistakable for a complete one. Worker names stay masked; answer keys never appear.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "ASSIGNED",
                "CLOSED"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page of retraining cases",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "cases",
                    "workers",
                    "nextCursor",
                    "hasMore",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "cases": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "organizationId",
                          "jobId",
                          "contractId",
                          "workerUserId",
                          "createdByUserId",
                          "sourceKind",
                          "sourceRef",
                          "observedMistake",
                          "expectedBehavior",
                          "workerSummary",
                          "specialization",
                          "occurrenceKind",
                          "priorCaseId",
                          "evidence",
                          "instructionRefs",
                          "contentPlan",
                          "mode",
                          "courseId",
                          "moduleKey",
                          "masteryRunLimit",
                          "masteryAntiGuessPolicy",
                          "dueOffsetMinutes",
                          "absoluteDue",
                          "priority",
                          "required",
                          "blockingMode",
                          "status",
                          "closedOutcome",
                          "closedReason",
                          "closedAt",
                          "assignmentId",
                          "bindingId",
                          "live",
                          "stateRevision",
                          "createdAt",
                          "updatedAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "organizationId": {
                            "type": "string"
                          },
                          "jobId": {
                            "type": "string"
                          },
                          "contractId": {
                            "type": "string"
                          },
                          "workerUserId": {
                            "type": "string"
                          },
                          "createdByUserId": {
                            "type": "string"
                          },
                          "sourceKind": {
                            "type": "string",
                            "enum": [
                              "MANUAL",
                              "FEEDBACK_REPORT",
                              "OPEN_LABEL_REVIEW",
                              "TASK"
                            ]
                          },
                          "sourceRef": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "observedMistake": {
                            "type": "string"
                          },
                          "expectedBehavior": {
                            "type": "string"
                          },
                          "workerSummary": {
                            "type": "string"
                          },
                          "specialization": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "occurrenceKind": {
                            "type": "string",
                            "enum": [
                              "FIRST",
                              "REPEATED"
                            ]
                          },
                          "priorCaseId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "evidence": {
                            "type": "array",
                            "maxItems": 25,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "kind",
                                "value"
                              ],
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "NOTE",
                                    "LINK",
                                    "FILE",
                                    "OPEN_LABEL_TASK"
                                  ]
                                },
                                "value": {
                                  "type": "string",
                                  "maxLength": 2000
                                },
                                "label": {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                "workerVisible": {
                                  "type": "boolean",
                                  "default": false
                                }
                              }
                            }
                          },
                          "instructionRefs": {
                            "type": "array",
                            "maxItems": 20,
                            "items": {
                              "type": "string"
                            }
                          },
                          "contentPlan": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "learningObjectives",
                                  "lessonOutline",
                                  "finalAssessmentBrief"
                                ],
                                "properties": {
                                  "learningObjectives": {
                                    "type": "array",
                                    "minItems": 1,
                                    "maxItems": 50,
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    }
                                  },
                                  "lessonOutline": {
                                    "type": "array",
                                    "minItems": 1,
                                    "maxItems": 50,
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    }
                                  },
                                  "practiceBriefs": {
                                    "type": "array",
                                    "maxItems": 50,
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    }
                                  },
                                  "formativeQuestionBriefs": {
                                    "type": "array",
                                    "maxItems": 50,
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    }
                                  },
                                  "finalAssessmentBrief": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "intent",
                                      "passingRequirement"
                                    ],
                                    "properties": {
                                      "intent": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "passingRequirement": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "passThresholdPercent": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ],
                                        "minimum": 0,
                                        "maximum": 100
                                      }
                                    }
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "MASTERY",
                              "EMPLOYER_REVIEW"
                            ]
                          },
                          "courseId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "moduleKey": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "masteryRunLimit": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 10
                          },
                          "masteryAntiGuessPolicy": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "schemaVersion",
                                  "cooldownStepsSeconds",
                                  "restartScope"
                                ],
                                "properties": {
                                  "schemaVersion": {
                                    "type": "integer",
                                    "enum": [
                                      1
                                    ]
                                  },
                                  "cooldownStepsSeconds": {
                                    "type": "array",
                                    "minItems": 1,
                                    "maxItems": 10,
                                    "items": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3600
                                    }
                                  },
                                  "restartScope": {
                                    "type": "string",
                                    "enum": [
                                      "WHOLE_MODULE",
                                      "MISSED_QUESTIONS"
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "dueOffsetMinutes": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 525600
                          },
                          "absoluteDue": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "localDate",
                                  "localTime",
                                  "timeZone"
                                ],
                                "properties": {
                                  "localDate": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "localTime": {
                                    "type": "string",
                                    "pattern": "^\\d{2}:\\d{2}$"
                                  },
                                  "timeZone": {
                                    "type": "string",
                                    "maxLength": 80
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "priority": {
                            "type": "string",
                            "enum": [
                              "NORMAL",
                              "HIGH",
                              "URGENT"
                            ]
                          },
                          "required": {
                            "type": "boolean"
                          },
                          "blockingMode": {
                            "type": "string",
                            "enum": [
                              "NONE",
                              "IMMEDIATE",
                              "AFTER_DUE"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "ASSIGNED",
                              "CLOSED"
                            ]
                          },
                          "closedOutcome": {
                            "oneOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "PASSED",
                                  "FAILED",
                                  "CANCELLED",
                                  "SUPERSEDED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "closedReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "closedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "assignmentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "bindingId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "live": {
                            "description": "Live projection joined from the CANONICAL assignment row at read time (get/list); the case never stores a second copy of training state.",
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "assignmentStatus",
                                  "waitingOnRole",
                                  "assignedAt",
                                  "dueAt",
                                  "submittedAt",
                                  "completedAt"
                                ],
                                "properties": {
                                  "assignmentStatus": {
                                    "type": "string"
                                  },
                                  "waitingOnRole": {
                                    "type": "string"
                                  },
                                  "assignedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "dueAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "completedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "stateRevision": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "workers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "contractId",
                          "displayName"
                        ],
                        "properties": {
                          "contractId": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string",
                            "description": "Masked — \"First L.\" only."
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Cursor outside this authorized filtered result set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/retraining/cases/{caseId}": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "getLmsRetrainingCase",
        "summary": "Read one retraining case with live canonical projections",
        "description": "Requires `lms:read` plus per-job member access. Returns the case, the masked worker, the LIVE canonical assignment projection, the employer review detail (authorized responses and grading state — answer keys never appear), and the first page of immutable mastery run history.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retraining case",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "case",
                    "worker",
                    "assignment",
                    "review",
                    "runs",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "case": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "organizationId",
                        "jobId",
                        "contractId",
                        "workerUserId",
                        "createdByUserId",
                        "sourceKind",
                        "sourceRef",
                        "observedMistake",
                        "expectedBehavior",
                        "workerSummary",
                        "specialization",
                        "occurrenceKind",
                        "priorCaseId",
                        "evidence",
                        "instructionRefs",
                        "contentPlan",
                        "mode",
                        "courseId",
                        "moduleKey",
                        "masteryRunLimit",
                        "masteryAntiGuessPolicy",
                        "dueOffsetMinutes",
                        "absoluteDue",
                        "priority",
                        "required",
                        "blockingMode",
                        "status",
                        "closedOutcome",
                        "closedReason",
                        "closedAt",
                        "assignmentId",
                        "bindingId",
                        "live",
                        "stateRevision",
                        "createdAt",
                        "updatedAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "contractId": {
                          "type": "string"
                        },
                        "workerUserId": {
                          "type": "string"
                        },
                        "createdByUserId": {
                          "type": "string"
                        },
                        "sourceKind": {
                          "type": "string",
                          "enum": [
                            "MANUAL",
                            "FEEDBACK_REPORT",
                            "OPEN_LABEL_REVIEW",
                            "TASK"
                          ]
                        },
                        "sourceRef": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "observedMistake": {
                          "type": "string"
                        },
                        "expectedBehavior": {
                          "type": "string"
                        },
                        "workerSummary": {
                          "type": "string"
                        },
                        "specialization": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "occurrenceKind": {
                          "type": "string",
                          "enum": [
                            "FIRST",
                            "REPEATED"
                          ]
                        },
                        "priorCaseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "evidence": {
                          "type": "array",
                          "maxItems": 25,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "value"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "NOTE",
                                  "LINK",
                                  "FILE",
                                  "OPEN_LABEL_TASK"
                                ]
                              },
                              "value": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "workerVisible": {
                                "type": "boolean",
                                "default": false
                              }
                            }
                          }
                        },
                        "instructionRefs": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string"
                          }
                        },
                        "contentPlan": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "learningObjectives",
                                "lessonOutline",
                                "finalAssessmentBrief"
                              ],
                              "properties": {
                                "learningObjectives": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "lessonOutline": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "practiceBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "formativeQuestionBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "finalAssessmentBrief": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "intent",
                                    "passingRequirement"
                                  ],
                                  "properties": {
                                    "intent": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passingRequirement": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passThresholdPercent": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0,
                                      "maximum": 100
                                    }
                                  }
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "MASTERY",
                            "EMPLOYER_REVIEW"
                          ]
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "moduleKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "masteryRunLimit": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10
                        },
                        "masteryAntiGuessPolicy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "schemaVersion",
                                "cooldownStepsSeconds",
                                "restartScope"
                              ],
                              "properties": {
                                "schemaVersion": {
                                  "type": "integer",
                                  "enum": [
                                    1
                                  ]
                                },
                                "cooldownStepsSeconds": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 10,
                                  "items": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 3600
                                  }
                                },
                                "restartScope": {
                                  "type": "string",
                                  "enum": [
                                    "WHOLE_MODULE",
                                    "MISSED_QUESTIONS"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dueOffsetMinutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 525600
                        },
                        "absoluteDue": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "localDate",
                                "localTime",
                                "timeZone"
                              ],
                              "properties": {
                                "localDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "localTime": {
                                  "type": "string",
                                  "pattern": "^\\d{2}:\\d{2}$"
                                },
                                "timeZone": {
                                  "type": "string",
                                  "maxLength": 80
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priority": {
                          "type": "string",
                          "enum": [
                            "NORMAL",
                            "HIGH",
                            "URGENT"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "blockingMode": {
                          "type": "string",
                          "enum": [
                            "NONE",
                            "IMMEDIATE",
                            "AFTER_DUE"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "ASSIGNED",
                            "CLOSED"
                          ]
                        },
                        "closedOutcome": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "PASSED",
                                "FAILED",
                                "CANCELLED",
                                "SUPERSEDED"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "closedReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "closedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "bindingId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "live": {
                          "description": "Live projection joined from the CANONICAL assignment row at read time (get/list); the case never stores a second copy of training state.",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "assignmentStatus",
                                "waitingOnRole",
                                "assignedAt",
                                "dueAt",
                                "submittedAt",
                                "completedAt"
                              ],
                              "properties": {
                                "assignmentStatus": {
                                  "type": "string"
                                },
                                "waitingOnRole": {
                                  "type": "string"
                                },
                                "assignedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "dueAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "submittedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "completedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "stateRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "worker": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "contractId",
                        "displayName"
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked — \"First L.\" only."
                        }
                      }
                    },
                    "assignment": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/LmsAssignmentRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "review": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "assignmentStatus",
                            "waitingOnRole",
                            "submittedAt",
                            "completionPolicy",
                            "returnGrants",
                            "canReturn",
                            "workerName",
                            "courseTitle",
                            "lessons",
                            "links"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "assignmentStatus": {
                              "type": "string"
                            },
                            "waitingOnRole": {
                              "type": "string"
                            },
                            "submittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "SYSTEM",
                                "EMPLOYER_REVIEW"
                              ]
                            },
                            "returnGrants": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "canReturn": {
                              "type": "boolean"
                            },
                            "workerName": {
                              "type": "string"
                            },
                            "courseTitle": {
                              "type": "string"
                            },
                            "lessons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "lessonTitle",
                                  "status",
                                  "reviewReason",
                                  "manualReview",
                                  "attempt",
                                  "reviewTarget",
                                  "projection",
                                  "retry",
                                  "attemptHistory",
                                  "responseQuestions"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "lessonTitle": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "reviewReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "manualReview": {
                                    "type": "boolean"
                                  },
                                  "attempt": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "id",
                                      "number",
                                      "submittedAt",
                                      "formTitle",
                                      "resultReleasedAt"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "integer",
                                        "minimum": 1
                                      },
                                      "submittedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "formTitle": {
                                        "type": "string"
                                      },
                                      "resultReleasedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      }
                                    }
                                  },
                                  "reviewTarget": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "assignmentId",
                                          "lessonKey",
                                          "attemptId",
                                          "assessmentId",
                                          "courseVersionId",
                                          "releaseId",
                                          "formVersionId",
                                          "targetHash",
                                          "latestAttemptId",
                                          "isLatestAttempt"
                                        ],
                                        "properties": {
                                          "assignmentId": {
                                            "type": "string"
                                          },
                                          "lessonKey": {
                                            "type": "string"
                                          },
                                          "attemptId": {
                                            "type": "string"
                                          },
                                          "assessmentId": {
                                            "type": "string"
                                          },
                                          "courseVersionId": {
                                            "type": "string"
                                          },
                                          "releaseId": {
                                            "type": "string"
                                          },
                                          "formVersionId": {
                                            "type": "string"
                                          },
                                          "targetHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          },
                                          "latestAttemptId": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "isLatestAttempt": {
                                            "type": "boolean"
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "projection": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "earnedPoints",
                                          "possiblePoints",
                                          "passed"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string"
                                          },
                                          "earnedPoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "possiblePoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "passed": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "retry": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "canRetry",
                                          "exhausted",
                                          "attemptCount",
                                          "maxAttempts",
                                          "returnGrants"
                                        ],
                                        "properties": {
                                          "canRetry": {
                                            "type": "boolean"
                                          },
                                          "exhausted": {
                                            "type": "boolean"
                                          },
                                          "attemptCount": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "maxAttempts": {
                                            "type": [
                                              "integer",
                                              "null"
                                            ],
                                            "minimum": 1
                                          },
                                          "returnGrants": {
                                            "type": "integer",
                                            "minimum": 0
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "attemptHistory": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "id",
                                        "number",
                                        "status",
                                        "submittedAt",
                                        "resultReleasedAt",
                                        "projection"
                                      ],
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "number": {
                                          "type": "integer",
                                          "minimum": 1
                                        },
                                        "status": {
                                          "type": "string"
                                        },
                                        "submittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "resultReleasedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "projection": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "state",
                                                "earnedPoints",
                                                "possiblePoints",
                                                "passed"
                                              ],
                                              "properties": {
                                                "state": {
                                                  "type": "string"
                                                },
                                                "earnedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "possiblePoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "passed": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "responseQuestions": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "questionId",
                                        "prompt",
                                        "answer",
                                        "responseText",
                                        "manualMaxPoints",
                                        "grade",
                                        "currentManualGrade"
                                      ],
                                      "properties": {
                                        "questionId": {
                                          "type": "string"
                                        },
                                        "prompt": {
                                          "type": "string"
                                        },
                                        "answer": {
                                          "description": "Immutable raw stored Native Forms answer value (string, number, boolean, string array, or null). Never a correct answer or key."
                                        },
                                        "responseText": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "manualMaxPoints": {
                                          "type": [
                                            "number",
                                            "null"
                                          ]
                                        },
                                        "grade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "correct",
                                                "awardedPoints",
                                                "maxPoints",
                                                "manuallyGraded"
                                              ],
                                              "properties": {
                                                "correct": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                },
                                                "awardedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "manuallyGraded": {
                                                  "type": "boolean"
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "currentManualGrade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "awardedPoints",
                                                "maxPoints",
                                                "reason"
                                              ],
                                              "properties": {
                                                "awardedPoints": {
                                                  "type": "number"
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "reason": {
                                                  "type": [
                                                    "string",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "links": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/LmsCanonicalLink"
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "runs": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "items",
                            "nextCursor",
                            "hasMore"
                          ],
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "runNumber",
                                  "status",
                                  "startedAt",
                                  "submittedAt",
                                  "wrongCount",
                                  "unansweredCount"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "runNumber": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "startedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "wrongCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "unansweredCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  }
                                }
                              }
                            },
                            "nextCursor": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "hasMore": {
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Case not found in this organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "lms"
        ],
        "operationId": "updateLmsRetrainingCase",
        "summary": "Update a DRAFT retraining case under its CAS revision",
        "description": "Requires `lms:write` and `Idempotency-Key`. Patches a DRAFT case under `expectedStateRevision`. The due channel stays EXACTLY ONE of `dueOffsetMinutes` XOR `absoluteDue` — switching channels requires clearing the other in the SAME patch. Occurrence/duplicate/source guards re-run on the effective values.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedStateRevision",
                  "patch"
                ],
                "properties": {
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "patch": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "observedMistake": {
                        "type": "string",
                        "maxLength": 5000
                      },
                      "expectedBehavior": {
                        "type": "string",
                        "maxLength": 5000
                      },
                      "workerSummary": {
                        "type": "string",
                        "maxLength": 2000
                      },
                      "specialization": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 300
                      },
                      "sourceKind": {
                        "type": "string",
                        "enum": [
                          "MANUAL",
                          "FEEDBACK_REPORT",
                          "OPEN_LABEL_REVIEW",
                          "TASK"
                        ]
                      },
                      "sourceRef": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 300
                      },
                      "occurrenceKind": {
                        "type": "string",
                        "enum": [
                          "FIRST",
                          "REPEATED"
                        ]
                      },
                      "priorCaseId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "evidence": {
                        "type": "array",
                        "maxItems": 25,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "value"
                          ],
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "NOTE",
                                "LINK",
                                "FILE",
                                "OPEN_LABEL_TASK"
                              ]
                            },
                            "value": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "label": {
                              "type": "string",
                              "maxLength": 120
                            },
                            "workerVisible": {
                              "type": "boolean",
                              "default": false
                            }
                          }
                        }
                      },
                      "instructionRefs": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string"
                        }
                      },
                      "contentPlan": {
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "learningObjectives",
                              "lessonOutline",
                              "finalAssessmentBrief"
                            ],
                            "properties": {
                              "learningObjectives": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 50,
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000
                                }
                              },
                              "lessonOutline": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 50,
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000
                                }
                              },
                              "practiceBriefs": {
                                "type": "array",
                                "maxItems": 50,
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000
                                }
                              },
                              "formativeQuestionBriefs": {
                                "type": "array",
                                "maxItems": 50,
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000
                                }
                              },
                              "finalAssessmentBrief": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "intent",
                                  "passingRequirement"
                                ],
                                "properties": {
                                  "intent": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  },
                                  "passingRequirement": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  },
                                  "passThresholdPercent": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 100
                                  }
                                }
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "MASTERY",
                          "EMPLOYER_REVIEW"
                        ]
                      },
                      "courseId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "moduleKey": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "masteryRunLimit": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 1,
                        "maximum": 10
                      },
                      "masteryAntiGuessPolicy": {
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "schemaVersion",
                              "cooldownStepsSeconds",
                              "restartScope"
                            ],
                            "properties": {
                              "schemaVersion": {
                                "type": "integer",
                                "enum": [
                                  1
                                ]
                              },
                              "cooldownStepsSeconds": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 10,
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 3600
                                }
                              },
                              "restartScope": {
                                "type": "string",
                                "enum": [
                                  "WHOLE_MODULE",
                                  "MISSED_QUESTIONS"
                                ]
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "dueOffsetMinutes": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 1,
                        "maximum": 525600,
                        "description": "Relative due in minutes, frozen to one instant at plan time. EXACTLY ONE due channel per case: dueOffsetMinutes XOR absoluteDue, never both and never neither (both or neither refuses). Null clears a channel, so a patch that switches channels sets one and nulls the other."
                      },
                      "absoluteDue": {
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "localDate",
                              "localTime",
                              "timeZone"
                            ],
                            "properties": {
                              "localDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "localTime": {
                                "type": "string",
                                "pattern": "^\\d{2}:\\d{2}$"
                              },
                              "timeZone": {
                                "type": "string",
                                "maxLength": 80
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Wall-clock due {localDate, localTime, timeZone}, resolved fail-closed against real IANA zones and DST at plan time. EXACTLY ONE due channel per case: dueOffsetMinutes XOR absoluteDue, never both and never neither (both or neither refuses). Null clears a channel, so a patch that switches channels sets one and nulls the other."
                      },
                      "priority": {
                        "type": "string",
                        "enum": [
                          "NORMAL",
                          "HIGH",
                          "URGENT"
                        ]
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "blockingMode": {
                        "type": "string",
                        "enum": [
                          "NONE",
                          "IMMEDIATE",
                          "AFTER_DUE"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated retraining case",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "case",
                    "worker",
                    "assignment",
                    "review",
                    "runs",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "case": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "organizationId",
                        "jobId",
                        "contractId",
                        "workerUserId",
                        "createdByUserId",
                        "sourceKind",
                        "sourceRef",
                        "observedMistake",
                        "expectedBehavior",
                        "workerSummary",
                        "specialization",
                        "occurrenceKind",
                        "priorCaseId",
                        "evidence",
                        "instructionRefs",
                        "contentPlan",
                        "mode",
                        "courseId",
                        "moduleKey",
                        "masteryRunLimit",
                        "masteryAntiGuessPolicy",
                        "dueOffsetMinutes",
                        "absoluteDue",
                        "priority",
                        "required",
                        "blockingMode",
                        "status",
                        "closedOutcome",
                        "closedReason",
                        "closedAt",
                        "assignmentId",
                        "bindingId",
                        "live",
                        "stateRevision",
                        "createdAt",
                        "updatedAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "contractId": {
                          "type": "string"
                        },
                        "workerUserId": {
                          "type": "string"
                        },
                        "createdByUserId": {
                          "type": "string"
                        },
                        "sourceKind": {
                          "type": "string",
                          "enum": [
                            "MANUAL",
                            "FEEDBACK_REPORT",
                            "OPEN_LABEL_REVIEW",
                            "TASK"
                          ]
                        },
                        "sourceRef": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "observedMistake": {
                          "type": "string"
                        },
                        "expectedBehavior": {
                          "type": "string"
                        },
                        "workerSummary": {
                          "type": "string"
                        },
                        "specialization": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "occurrenceKind": {
                          "type": "string",
                          "enum": [
                            "FIRST",
                            "REPEATED"
                          ]
                        },
                        "priorCaseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "evidence": {
                          "type": "array",
                          "maxItems": 25,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "value"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "NOTE",
                                  "LINK",
                                  "FILE",
                                  "OPEN_LABEL_TASK"
                                ]
                              },
                              "value": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "workerVisible": {
                                "type": "boolean",
                                "default": false
                              }
                            }
                          }
                        },
                        "instructionRefs": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string"
                          }
                        },
                        "contentPlan": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "learningObjectives",
                                "lessonOutline",
                                "finalAssessmentBrief"
                              ],
                              "properties": {
                                "learningObjectives": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "lessonOutline": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "practiceBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "formativeQuestionBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "finalAssessmentBrief": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "intent",
                                    "passingRequirement"
                                  ],
                                  "properties": {
                                    "intent": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passingRequirement": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passThresholdPercent": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0,
                                      "maximum": 100
                                    }
                                  }
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "MASTERY",
                            "EMPLOYER_REVIEW"
                          ]
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "moduleKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "masteryRunLimit": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10
                        },
                        "masteryAntiGuessPolicy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "schemaVersion",
                                "cooldownStepsSeconds",
                                "restartScope"
                              ],
                              "properties": {
                                "schemaVersion": {
                                  "type": "integer",
                                  "enum": [
                                    1
                                  ]
                                },
                                "cooldownStepsSeconds": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 10,
                                  "items": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 3600
                                  }
                                },
                                "restartScope": {
                                  "type": "string",
                                  "enum": [
                                    "WHOLE_MODULE",
                                    "MISSED_QUESTIONS"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dueOffsetMinutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 525600
                        },
                        "absoluteDue": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "localDate",
                                "localTime",
                                "timeZone"
                              ],
                              "properties": {
                                "localDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "localTime": {
                                  "type": "string",
                                  "pattern": "^\\d{2}:\\d{2}$"
                                },
                                "timeZone": {
                                  "type": "string",
                                  "maxLength": 80
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priority": {
                          "type": "string",
                          "enum": [
                            "NORMAL",
                            "HIGH",
                            "URGENT"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "blockingMode": {
                          "type": "string",
                          "enum": [
                            "NONE",
                            "IMMEDIATE",
                            "AFTER_DUE"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "ASSIGNED",
                            "CLOSED"
                          ]
                        },
                        "closedOutcome": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "PASSED",
                                "FAILED",
                                "CANCELLED",
                                "SUPERSEDED"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "closedReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "closedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "bindingId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "live": {
                          "description": "Live projection joined from the CANONICAL assignment row at read time (get/list); the case never stores a second copy of training state.",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "assignmentStatus",
                                "waitingOnRole",
                                "assignedAt",
                                "dueAt",
                                "submittedAt",
                                "completedAt"
                              ],
                              "properties": {
                                "assignmentStatus": {
                                  "type": "string"
                                },
                                "waitingOnRole": {
                                  "type": "string"
                                },
                                "assignedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "dueAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "submittedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "completedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "stateRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "worker": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "contractId",
                        "displayName"
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked — \"First L.\" only."
                        }
                      }
                    },
                    "assignment": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/LmsAssignmentRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "review": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "assignmentStatus",
                            "waitingOnRole",
                            "submittedAt",
                            "completionPolicy",
                            "returnGrants",
                            "canReturn",
                            "workerName",
                            "courseTitle",
                            "lessons",
                            "links"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "assignmentStatus": {
                              "type": "string"
                            },
                            "waitingOnRole": {
                              "type": "string"
                            },
                            "submittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "SYSTEM",
                                "EMPLOYER_REVIEW"
                              ]
                            },
                            "returnGrants": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "canReturn": {
                              "type": "boolean"
                            },
                            "workerName": {
                              "type": "string"
                            },
                            "courseTitle": {
                              "type": "string"
                            },
                            "lessons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "lessonTitle",
                                  "status",
                                  "reviewReason",
                                  "manualReview",
                                  "attempt",
                                  "reviewTarget",
                                  "projection",
                                  "retry",
                                  "attemptHistory",
                                  "responseQuestions"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "lessonTitle": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "reviewReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "manualReview": {
                                    "type": "boolean"
                                  },
                                  "attempt": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "id",
                                      "number",
                                      "submittedAt",
                                      "formTitle",
                                      "resultReleasedAt"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "integer",
                                        "minimum": 1
                                      },
                                      "submittedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "formTitle": {
                                        "type": "string"
                                      },
                                      "resultReleasedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      }
                                    }
                                  },
                                  "reviewTarget": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "assignmentId",
                                          "lessonKey",
                                          "attemptId",
                                          "assessmentId",
                                          "courseVersionId",
                                          "releaseId",
                                          "formVersionId",
                                          "targetHash",
                                          "latestAttemptId",
                                          "isLatestAttempt"
                                        ],
                                        "properties": {
                                          "assignmentId": {
                                            "type": "string"
                                          },
                                          "lessonKey": {
                                            "type": "string"
                                          },
                                          "attemptId": {
                                            "type": "string"
                                          },
                                          "assessmentId": {
                                            "type": "string"
                                          },
                                          "courseVersionId": {
                                            "type": "string"
                                          },
                                          "releaseId": {
                                            "type": "string"
                                          },
                                          "formVersionId": {
                                            "type": "string"
                                          },
                                          "targetHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          },
                                          "latestAttemptId": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "isLatestAttempt": {
                                            "type": "boolean"
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "projection": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "earnedPoints",
                                          "possiblePoints",
                                          "passed"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string"
                                          },
                                          "earnedPoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "possiblePoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "passed": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "retry": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "canRetry",
                                          "exhausted",
                                          "attemptCount",
                                          "maxAttempts",
                                          "returnGrants"
                                        ],
                                        "properties": {
                                          "canRetry": {
                                            "type": "boolean"
                                          },
                                          "exhausted": {
                                            "type": "boolean"
                                          },
                                          "attemptCount": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "maxAttempts": {
                                            "type": [
                                              "integer",
                                              "null"
                                            ],
                                            "minimum": 1
                                          },
                                          "returnGrants": {
                                            "type": "integer",
                                            "minimum": 0
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "attemptHistory": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "id",
                                        "number",
                                        "status",
                                        "submittedAt",
                                        "resultReleasedAt",
                                        "projection"
                                      ],
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "number": {
                                          "type": "integer",
                                          "minimum": 1
                                        },
                                        "status": {
                                          "type": "string"
                                        },
                                        "submittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "resultReleasedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "projection": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "state",
                                                "earnedPoints",
                                                "possiblePoints",
                                                "passed"
                                              ],
                                              "properties": {
                                                "state": {
                                                  "type": "string"
                                                },
                                                "earnedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "possiblePoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "passed": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "responseQuestions": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "questionId",
                                        "prompt",
                                        "answer",
                                        "responseText",
                                        "manualMaxPoints",
                                        "grade",
                                        "currentManualGrade"
                                      ],
                                      "properties": {
                                        "questionId": {
                                          "type": "string"
                                        },
                                        "prompt": {
                                          "type": "string"
                                        },
                                        "answer": {
                                          "description": "Immutable raw stored Native Forms answer value (string, number, boolean, string array, or null). Never a correct answer or key."
                                        },
                                        "responseText": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "manualMaxPoints": {
                                          "type": [
                                            "number",
                                            "null"
                                          ]
                                        },
                                        "grade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "correct",
                                                "awardedPoints",
                                                "maxPoints",
                                                "manuallyGraded"
                                              ],
                                              "properties": {
                                                "correct": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                },
                                                "awardedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "manuallyGraded": {
                                                  "type": "boolean"
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "currentManualGrade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "awardedPoints",
                                                "maxPoints",
                                                "reason"
                                              ],
                                              "properties": {
                                                "awardedPoints": {
                                                  "type": "number"
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "reason": {
                                                  "type": [
                                                    "string",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "links": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/LmsCanonicalLink"
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "runs": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "items",
                            "nextCursor",
                            "hasMore"
                          ],
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "runNumber",
                                  "status",
                                  "startedAt",
                                  "submittedAt",
                                  "wrongCount",
                                  "unansweredCount"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "runNumber": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "startedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "wrongCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "unansweredCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  }
                                }
                              }
                            },
                            "nextCursor": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "hasMore": {
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Not DRAFT, stale revision, or duplicate open occurrence/source",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Due channel violation or invalid wall-clock due",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/retraining/cases/{caseId}/scaffold": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "scaffoldLmsRetrainingCase",
        "summary": "Generate a strictly no-write retraining authoring scaffold",
        "description": "Requires `lms:write` because the DRAFT case contains employer-private evidence. This strictly zero-write operation produces deterministic authoring guidance over the existing LMS, Native Forms, Preview, publish, module-registration, and Project To-do assignment operations. It creates no course, assessment, Preview session, assignment, Project To-do, notification, attempt, or audit mutation and deliberately takes no Idempotency-Key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "No-write retraining authoring scaffold",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "schemaVersion",
                    "caseId",
                    "jobId",
                    "mode",
                    "stateRevision",
                    "captureHash",
                    "worker",
                    "authoringIntent",
                    "grounding",
                    "outline",
                    "constraints",
                    "nextActions",
                    "effects"
                  ],
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "enum": [
                        1
                      ]
                    },
                    "caseId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "MASTERY",
                        "EMPLOYER_REVIEW"
                      ]
                    },
                    "stateRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "captureHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "worker": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "contractId",
                        "displayName"
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked — \"First L.\" only."
                        }
                      }
                    },
                    "authoringIntent": {
                      "$ref": "#/components/schemas/LmsCourseAuthoringIntent"
                    },
                    "grounding": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "specialization",
                        "sourceKind",
                        "sourceRef",
                        "observedMistake",
                        "expectedBehavior",
                        "workerSummary",
                        "evidence",
                        "instructionRefs"
                      ],
                      "properties": {
                        "specialization": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sourceKind": {
                          "type": "string",
                          "enum": [
                            "MANUAL",
                            "FEEDBACK_REPORT",
                            "OPEN_LABEL_REVIEW",
                            "TASK"
                          ]
                        },
                        "sourceRef": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "observedMistake": {
                          "type": "string"
                        },
                        "expectedBehavior": {
                          "type": "string"
                        },
                        "workerSummary": {
                          "type": "string"
                        },
                        "evidence": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "value"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "NOTE",
                                  "LINK",
                                  "FILE",
                                  "OPEN_LABEL_TASK"
                                ]
                              },
                              "value": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "workerVisible": {
                                "type": "boolean",
                                "default": false
                              }
                            }
                          }
                        },
                        "instructionRefs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "outline": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "learningObjectives",
                        "lessons",
                        "practiceBriefs",
                        "formativeQuestionBriefs",
                        "finalAssessment"
                      ],
                      "properties": {
                        "learningObjectives": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "lessons": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "practiceBriefs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "formativeQuestionBriefs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "finalAssessment": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "intent",
                                "passingRequirement"
                              ],
                              "properties": {
                                "intent": {
                                  "type": "string"
                                },
                                "passingRequirement": {
                                  "type": "string"
                                },
                                "passThresholdPercent": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ],
                                  "minimum": 0,
                                  "maximum": 100
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "constraints": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "exactlyOneWorker",
                        "exactlyOneModule",
                        "futureHireExpansion",
                        "previewIsolated",
                        "assignmentEngine",
                        "assessmentEngine",
                        "answerKeysIncluded",
                        "requiredAutoGradedQuestions",
                        "manualQuestionsAllowed"
                      ],
                      "properties": {
                        "exactlyOneWorker": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "exactlyOneModule": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "futureHireExpansion": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        },
                        "previewIsolated": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "assignmentEngine": {
                          "type": "string",
                          "enum": [
                            "PROJECT_TODOS"
                          ]
                        },
                        "assessmentEngine": {
                          "type": "string",
                          "enum": [
                            "NATIVE_FORMS"
                          ]
                        },
                        "answerKeysIncluded": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        },
                        "requiredAutoGradedQuestions": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "min"
                              ],
                              "properties": {
                                "min": {
                                  "type": "integer",
                                  "enum": [
                                    1
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "manualQuestionsAllowed": {
                          "type": "boolean"
                        }
                      }
                    },
                    "nextActions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "order",
                          "operationId",
                          "purpose",
                          "request"
                        ],
                        "properties": {
                          "order": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "operationId": {
                            "type": "string",
                            "enum": [
                              "lms.courses.manage",
                              "lms.assessments.manage",
                              "lms.courses.validate",
                              "lms.preview.sessions.create",
                              "lms.courses.publish",
                              "lms.retraining.modules.register",
                              "lms.retraining.cases.update",
                              "lms.retraining.cases.plan"
                            ]
                          },
                          "purpose": {
                            "type": "string"
                          },
                          "request": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "action": {
                                "type": "string",
                                "enum": [
                                  "create",
                                  "update"
                                ]
                              },
                              "caseId": {
                                "type": "string"
                              },
                              "courseId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "moduleKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "expectedStateRevision": {
                                "type": "integer",
                                "minimum": 1
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "MASTERY",
                                  "EMPLOYER_REVIEW"
                                ]
                              },
                              "validationIntent": {
                                "type": "string",
                                "enum": [
                                  "STANDARD",
                                  "INDIVIDUAL_MASTERY"
                                ]
                              },
                              "completionPolicy": {
                                "type": "string",
                                "enum": [
                                  "SYSTEM",
                                  "EMPLOYER_REVIEW"
                                ]
                              },
                              "draftTree": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "schemaVersion",
                                  "authoringIntent",
                                  "modules"
                                ],
                                "properties": {
                                  "schemaVersion": {
                                    "type": "integer",
                                    "enum": [
                                      1
                                    ]
                                  },
                                  "authoringIntent": {
                                    "$ref": "#/components/schemas/LmsCourseAuthoringIntent"
                                  },
                                  "modules": {
                                    "type": "array",
                                    "maxItems": 0,
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "effects": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "writesApplied",
                        "notificationsSent",
                        "attemptsCreated"
                      ],
                      "properties": {
                        "writesApplied": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        },
                        "notificationsSent": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        },
                        "attemptsCreated": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Case not found in this organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Case is not DRAFT",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/retraining/cases/{caseId}/plan": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "planLmsRetrainingCase",
        "summary": "Strictly zero-write retraining assignment plan",
        "description": "Requires `lms:write` because it previews a protected mutation, but is strictly zero-write: no case row, To-do, attempt, notification, or event is created (`effects.planWrites/planNotifications/planAttempts` are pinned zeros) and it deliberately takes NO Idempotency-Key. Resolves the case into the exact canonical assignment plan: masked recipient, immutable course version + `courseContentHash`, mastery eligibility, the case `stateRevision` and `captureHash` the confirm covers, the FROZEN due instant (`plannedDue`, offset-derived included — a delayed confirm applies this exact instant verbatim), explicit confirm effects (exactly one Project To-do assignment for exactly one SELECTED recipient; future hires never included; one worker notification on confirm), the request hash, and a signed short-lived receipt for the assign step.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Zero-write retraining plan",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "caseId",
                    "stateRevision",
                    "captureHash",
                    "courseContentHash",
                    "plannedDue",
                    "effects",
                    "ok",
                    "plan",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "caseId": {
                      "type": "string"
                    },
                    "stateRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "captureHash": {
                      "type": "string"
                    },
                    "courseContentHash": {
                      "type": "string"
                    },
                    "plannedDue": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "schemaVersion",
                            "localDate",
                            "localTime",
                            "timeZone",
                            "dueAt"
                          ],
                          "properties": {
                            "schemaVersion": {
                              "type": "integer",
                              "enum": [
                                1
                              ]
                            },
                            "localDate": {
                              "type": "string"
                            },
                            "localTime": {
                              "type": "string"
                            },
                            "timeZone": {
                              "type": "string"
                            },
                            "dueAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "effects": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "projectTodoAssignments",
                        "selectedRecipients",
                        "futureHireExpansion",
                        "workerNotificationsOnConfirm",
                        "planWrites",
                        "planNotifications",
                        "planAttempts"
                      ],
                      "properties": {
                        "projectTodoAssignments": {
                          "type": "integer",
                          "enum": [
                            1
                          ]
                        },
                        "selectedRecipients": {
                          "type": "integer",
                          "enum": [
                            1
                          ]
                        },
                        "futureHireExpansion": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        },
                        "workerNotificationsOnConfirm": {
                          "type": "integer",
                          "enum": [
                            1
                          ]
                        },
                        "planWrites": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        },
                        "planNotifications": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        },
                        "planAttempts": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        }
                      }
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "plan": {
                      "$ref": "#/components/schemas/LmsAssignmentPlanReceipt"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Case not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Case is not DRAFT",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Module not chosen, course unpublished, or due instant in the past",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/retraining/cases/{caseId}/assign": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "assignLmsRetrainingCase",
        "summary": "Assign the case to its one selected worker (receipt-fenced)",
        "description": "Requires `lms:write`, `Idempotency-Key`, `confirmAssign: true`, and the EXACT signed `planReceiptToken` from the zero-write plan. Verifies the case CAS revision, then atomically creates the one Project To-do assignment while the case transitions DRAFT → ASSIGNED in the SAME transaction (an orphaned live assignment is structurally impossible). The frozen due instant from the reviewed plan applies verbatim. The receipt goes STALE on any capture, course-content, or revision drift and EXPIRED after its short TTL — re-plan and re-review instead of forcing.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedStateRevision",
                  "planReceiptToken",
                  "confirmAssign"
                ],
                "properties": {
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "planReceiptToken": {
                    "type": "string"
                  },
                  "confirmAssign": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "ASSIGNED retraining case with its live assignment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "case",
                    "worker",
                    "assignment",
                    "review",
                    "runs",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "case": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "organizationId",
                        "jobId",
                        "contractId",
                        "workerUserId",
                        "createdByUserId",
                        "sourceKind",
                        "sourceRef",
                        "observedMistake",
                        "expectedBehavior",
                        "workerSummary",
                        "specialization",
                        "occurrenceKind",
                        "priorCaseId",
                        "evidence",
                        "instructionRefs",
                        "contentPlan",
                        "mode",
                        "courseId",
                        "moduleKey",
                        "masteryRunLimit",
                        "masteryAntiGuessPolicy",
                        "dueOffsetMinutes",
                        "absoluteDue",
                        "priority",
                        "required",
                        "blockingMode",
                        "status",
                        "closedOutcome",
                        "closedReason",
                        "closedAt",
                        "assignmentId",
                        "bindingId",
                        "live",
                        "stateRevision",
                        "createdAt",
                        "updatedAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "contractId": {
                          "type": "string"
                        },
                        "workerUserId": {
                          "type": "string"
                        },
                        "createdByUserId": {
                          "type": "string"
                        },
                        "sourceKind": {
                          "type": "string",
                          "enum": [
                            "MANUAL",
                            "FEEDBACK_REPORT",
                            "OPEN_LABEL_REVIEW",
                            "TASK"
                          ]
                        },
                        "sourceRef": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "observedMistake": {
                          "type": "string"
                        },
                        "expectedBehavior": {
                          "type": "string"
                        },
                        "workerSummary": {
                          "type": "string"
                        },
                        "specialization": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "occurrenceKind": {
                          "type": "string",
                          "enum": [
                            "FIRST",
                            "REPEATED"
                          ]
                        },
                        "priorCaseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "evidence": {
                          "type": "array",
                          "maxItems": 25,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "value"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "NOTE",
                                  "LINK",
                                  "FILE",
                                  "OPEN_LABEL_TASK"
                                ]
                              },
                              "value": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "workerVisible": {
                                "type": "boolean",
                                "default": false
                              }
                            }
                          }
                        },
                        "instructionRefs": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string"
                          }
                        },
                        "contentPlan": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "learningObjectives",
                                "lessonOutline",
                                "finalAssessmentBrief"
                              ],
                              "properties": {
                                "learningObjectives": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "lessonOutline": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "practiceBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "formativeQuestionBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "finalAssessmentBrief": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "intent",
                                    "passingRequirement"
                                  ],
                                  "properties": {
                                    "intent": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passingRequirement": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passThresholdPercent": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0,
                                      "maximum": 100
                                    }
                                  }
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "MASTERY",
                            "EMPLOYER_REVIEW"
                          ]
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "moduleKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "masteryRunLimit": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10
                        },
                        "masteryAntiGuessPolicy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "schemaVersion",
                                "cooldownStepsSeconds",
                                "restartScope"
                              ],
                              "properties": {
                                "schemaVersion": {
                                  "type": "integer",
                                  "enum": [
                                    1
                                  ]
                                },
                                "cooldownStepsSeconds": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 10,
                                  "items": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 3600
                                  }
                                },
                                "restartScope": {
                                  "type": "string",
                                  "enum": [
                                    "WHOLE_MODULE",
                                    "MISSED_QUESTIONS"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dueOffsetMinutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 525600
                        },
                        "absoluteDue": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "localDate",
                                "localTime",
                                "timeZone"
                              ],
                              "properties": {
                                "localDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "localTime": {
                                  "type": "string",
                                  "pattern": "^\\d{2}:\\d{2}$"
                                },
                                "timeZone": {
                                  "type": "string",
                                  "maxLength": 80
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priority": {
                          "type": "string",
                          "enum": [
                            "NORMAL",
                            "HIGH",
                            "URGENT"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "blockingMode": {
                          "type": "string",
                          "enum": [
                            "NONE",
                            "IMMEDIATE",
                            "AFTER_DUE"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "ASSIGNED",
                            "CLOSED"
                          ]
                        },
                        "closedOutcome": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "PASSED",
                                "FAILED",
                                "CANCELLED",
                                "SUPERSEDED"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "closedReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "closedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "bindingId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "live": {
                          "description": "Live projection joined from the CANONICAL assignment row at read time (get/list); the case never stores a second copy of training state.",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "assignmentStatus",
                                "waitingOnRole",
                                "assignedAt",
                                "dueAt",
                                "submittedAt",
                                "completedAt"
                              ],
                              "properties": {
                                "assignmentStatus": {
                                  "type": "string"
                                },
                                "waitingOnRole": {
                                  "type": "string"
                                },
                                "assignedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "dueAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "submittedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "completedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "stateRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "worker": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "contractId",
                        "displayName"
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked — \"First L.\" only."
                        }
                      }
                    },
                    "assignment": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/LmsAssignmentRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "review": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "assignmentStatus",
                            "waitingOnRole",
                            "submittedAt",
                            "completionPolicy",
                            "returnGrants",
                            "canReturn",
                            "workerName",
                            "courseTitle",
                            "lessons",
                            "links"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "assignmentStatus": {
                              "type": "string"
                            },
                            "waitingOnRole": {
                              "type": "string"
                            },
                            "submittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "SYSTEM",
                                "EMPLOYER_REVIEW"
                              ]
                            },
                            "returnGrants": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "canReturn": {
                              "type": "boolean"
                            },
                            "workerName": {
                              "type": "string"
                            },
                            "courseTitle": {
                              "type": "string"
                            },
                            "lessons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "lessonTitle",
                                  "status",
                                  "reviewReason",
                                  "manualReview",
                                  "attempt",
                                  "reviewTarget",
                                  "projection",
                                  "retry",
                                  "attemptHistory",
                                  "responseQuestions"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "lessonTitle": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "reviewReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "manualReview": {
                                    "type": "boolean"
                                  },
                                  "attempt": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "id",
                                      "number",
                                      "submittedAt",
                                      "formTitle",
                                      "resultReleasedAt"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "integer",
                                        "minimum": 1
                                      },
                                      "submittedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "formTitle": {
                                        "type": "string"
                                      },
                                      "resultReleasedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      }
                                    }
                                  },
                                  "reviewTarget": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "assignmentId",
                                          "lessonKey",
                                          "attemptId",
                                          "assessmentId",
                                          "courseVersionId",
                                          "releaseId",
                                          "formVersionId",
                                          "targetHash",
                                          "latestAttemptId",
                                          "isLatestAttempt"
                                        ],
                                        "properties": {
                                          "assignmentId": {
                                            "type": "string"
                                          },
                                          "lessonKey": {
                                            "type": "string"
                                          },
                                          "attemptId": {
                                            "type": "string"
                                          },
                                          "assessmentId": {
                                            "type": "string"
                                          },
                                          "courseVersionId": {
                                            "type": "string"
                                          },
                                          "releaseId": {
                                            "type": "string"
                                          },
                                          "formVersionId": {
                                            "type": "string"
                                          },
                                          "targetHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          },
                                          "latestAttemptId": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "isLatestAttempt": {
                                            "type": "boolean"
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "projection": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "earnedPoints",
                                          "possiblePoints",
                                          "passed"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string"
                                          },
                                          "earnedPoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "possiblePoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "passed": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "retry": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "canRetry",
                                          "exhausted",
                                          "attemptCount",
                                          "maxAttempts",
                                          "returnGrants"
                                        ],
                                        "properties": {
                                          "canRetry": {
                                            "type": "boolean"
                                          },
                                          "exhausted": {
                                            "type": "boolean"
                                          },
                                          "attemptCount": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "maxAttempts": {
                                            "type": [
                                              "integer",
                                              "null"
                                            ],
                                            "minimum": 1
                                          },
                                          "returnGrants": {
                                            "type": "integer",
                                            "minimum": 0
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "attemptHistory": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "id",
                                        "number",
                                        "status",
                                        "submittedAt",
                                        "resultReleasedAt",
                                        "projection"
                                      ],
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "number": {
                                          "type": "integer",
                                          "minimum": 1
                                        },
                                        "status": {
                                          "type": "string"
                                        },
                                        "submittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "resultReleasedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "projection": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "state",
                                                "earnedPoints",
                                                "possiblePoints",
                                                "passed"
                                              ],
                                              "properties": {
                                                "state": {
                                                  "type": "string"
                                                },
                                                "earnedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "possiblePoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "passed": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "responseQuestions": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "questionId",
                                        "prompt",
                                        "answer",
                                        "responseText",
                                        "manualMaxPoints",
                                        "grade",
                                        "currentManualGrade"
                                      ],
                                      "properties": {
                                        "questionId": {
                                          "type": "string"
                                        },
                                        "prompt": {
                                          "type": "string"
                                        },
                                        "answer": {
                                          "description": "Immutable raw stored Native Forms answer value (string, number, boolean, string array, or null). Never a correct answer or key."
                                        },
                                        "responseText": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "manualMaxPoints": {
                                          "type": [
                                            "number",
                                            "null"
                                          ]
                                        },
                                        "grade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "correct",
                                                "awardedPoints",
                                                "maxPoints",
                                                "manuallyGraded"
                                              ],
                                              "properties": {
                                                "correct": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                },
                                                "awardedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "manuallyGraded": {
                                                  "type": "boolean"
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "currentManualGrade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "awardedPoints",
                                                "maxPoints",
                                                "reason"
                                              ],
                                              "properties": {
                                                "awardedPoints": {
                                                  "type": "number"
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "reason": {
                                                  "type": [
                                                    "string",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "links": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/LmsCanonicalLink"
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "runs": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "items",
                            "nextCursor",
                            "hasMore"
                          ],
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "runNumber",
                                  "status",
                                  "startedAt",
                                  "submittedAt",
                                  "wrongCount",
                                  "unansweredCount"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "runNumber": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "startedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "wrongCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "unansweredCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  }
                                }
                              }
                            },
                            "nextCursor": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "hasMore": {
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Stale/invalid/expired plan receipt, revision conflict, or one-shot claim conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/retraining/cases/{caseId}/close": {
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "closeLmsRetrainingCase",
        "summary": "Close a retraining case with an explicit outcome",
        "description": "Requires `lms:write`, `Idempotency-Key`, and `confirmClose: true`. PASSED requires the canonical assignment COMPLETED; FAILED requires a proven exhausted failure parked with the employer (the live assignment stays the single source of truth, and canonical RETURN remains the sole retry-grant path). CANCELLED/SUPERSEDED are management closures that never cancel the assignment itself. Closed occurrences never reopen — repeat retraining is a NEW case chained by priorCaseId. For an assigned case, CANCELLED needs the assignment already ended: while it is live, CANCELLED refuses 409 RETRAINING_CLOSE_OUTCOME_MISMATCH; cancel the assignment with `POST /lms/assignments/{assignmentId}/cancel` instead, which closes the case CANCELLED on its own.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "caseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedStateRevision",
                  "outcome",
                  "confirmClose"
                ],
                "properties": {
                  "expectedStateRevision": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "PASSED",
                      "FAILED",
                      "CANCELLED",
                      "SUPERSEDED"
                    ]
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "confirmClose": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "CLOSED retraining case",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "case",
                    "worker",
                    "assignment",
                    "review",
                    "runs",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "case": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "organizationId",
                        "jobId",
                        "contractId",
                        "workerUserId",
                        "createdByUserId",
                        "sourceKind",
                        "sourceRef",
                        "observedMistake",
                        "expectedBehavior",
                        "workerSummary",
                        "specialization",
                        "occurrenceKind",
                        "priorCaseId",
                        "evidence",
                        "instructionRefs",
                        "contentPlan",
                        "mode",
                        "courseId",
                        "moduleKey",
                        "masteryRunLimit",
                        "masteryAntiGuessPolicy",
                        "dueOffsetMinutes",
                        "absoluteDue",
                        "priority",
                        "required",
                        "blockingMode",
                        "status",
                        "closedOutcome",
                        "closedReason",
                        "closedAt",
                        "assignmentId",
                        "bindingId",
                        "live",
                        "stateRevision",
                        "createdAt",
                        "updatedAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "contractId": {
                          "type": "string"
                        },
                        "workerUserId": {
                          "type": "string"
                        },
                        "createdByUserId": {
                          "type": "string"
                        },
                        "sourceKind": {
                          "type": "string",
                          "enum": [
                            "MANUAL",
                            "FEEDBACK_REPORT",
                            "OPEN_LABEL_REVIEW",
                            "TASK"
                          ]
                        },
                        "sourceRef": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "observedMistake": {
                          "type": "string"
                        },
                        "expectedBehavior": {
                          "type": "string"
                        },
                        "workerSummary": {
                          "type": "string"
                        },
                        "specialization": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "occurrenceKind": {
                          "type": "string",
                          "enum": [
                            "FIRST",
                            "REPEATED"
                          ]
                        },
                        "priorCaseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "evidence": {
                          "type": "array",
                          "maxItems": 25,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "value"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "NOTE",
                                  "LINK",
                                  "FILE",
                                  "OPEN_LABEL_TASK"
                                ]
                              },
                              "value": {
                                "type": "string",
                                "maxLength": 2000
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "workerVisible": {
                                "type": "boolean",
                                "default": false
                              }
                            }
                          }
                        },
                        "instructionRefs": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string"
                          }
                        },
                        "contentPlan": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "learningObjectives",
                                "lessonOutline",
                                "finalAssessmentBrief"
                              ],
                              "properties": {
                                "learningObjectives": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "lessonOutline": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "practiceBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "formativeQuestionBriefs": {
                                  "type": "array",
                                  "maxItems": 50,
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2000
                                  }
                                },
                                "finalAssessmentBrief": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "intent",
                                    "passingRequirement"
                                  ],
                                  "properties": {
                                    "intent": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passingRequirement": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "passThresholdPercent": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0,
                                      "maximum": 100
                                    }
                                  }
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "MASTERY",
                            "EMPLOYER_REVIEW"
                          ]
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "moduleKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "masteryRunLimit": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10
                        },
                        "masteryAntiGuessPolicy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "schemaVersion",
                                "cooldownStepsSeconds",
                                "restartScope"
                              ],
                              "properties": {
                                "schemaVersion": {
                                  "type": "integer",
                                  "enum": [
                                    1
                                  ]
                                },
                                "cooldownStepsSeconds": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 10,
                                  "items": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 3600
                                  }
                                },
                                "restartScope": {
                                  "type": "string",
                                  "enum": [
                                    "WHOLE_MODULE",
                                    "MISSED_QUESTIONS"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dueOffsetMinutes": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 525600
                        },
                        "absoluteDue": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "localDate",
                                "localTime",
                                "timeZone"
                              ],
                              "properties": {
                                "localDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "localTime": {
                                  "type": "string",
                                  "pattern": "^\\d{2}:\\d{2}$"
                                },
                                "timeZone": {
                                  "type": "string",
                                  "maxLength": 80
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priority": {
                          "type": "string",
                          "enum": [
                            "NORMAL",
                            "HIGH",
                            "URGENT"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "blockingMode": {
                          "type": "string",
                          "enum": [
                            "NONE",
                            "IMMEDIATE",
                            "AFTER_DUE"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "ASSIGNED",
                            "CLOSED"
                          ]
                        },
                        "closedOutcome": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "PASSED",
                                "FAILED",
                                "CANCELLED",
                                "SUPERSEDED"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "closedReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "closedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "bindingId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "live": {
                          "description": "Live projection joined from the CANONICAL assignment row at read time (get/list); the case never stores a second copy of training state.",
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "assignmentStatus",
                                "waitingOnRole",
                                "assignedAt",
                                "dueAt",
                                "submittedAt",
                                "completedAt"
                              ],
                              "properties": {
                                "assignmentStatus": {
                                  "type": "string"
                                },
                                "waitingOnRole": {
                                  "type": "string"
                                },
                                "assignedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "dueAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "submittedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "completedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "stateRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "worker": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "contractId",
                        "displayName"
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked — \"First L.\" only."
                        }
                      }
                    },
                    "assignment": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/LmsAssignmentRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "review": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "assignmentId",
                            "assignmentStatus",
                            "waitingOnRole",
                            "submittedAt",
                            "completionPolicy",
                            "returnGrants",
                            "canReturn",
                            "workerName",
                            "courseTitle",
                            "lessons",
                            "links"
                          ],
                          "properties": {
                            "assignmentId": {
                              "type": "string"
                            },
                            "assignmentStatus": {
                              "type": "string"
                            },
                            "waitingOnRole": {
                              "type": "string"
                            },
                            "submittedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "SYSTEM",
                                "EMPLOYER_REVIEW"
                              ]
                            },
                            "returnGrants": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "canReturn": {
                              "type": "boolean"
                            },
                            "workerName": {
                              "type": "string"
                            },
                            "courseTitle": {
                              "type": "string"
                            },
                            "lessons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "lessonKey",
                                  "lessonTitle",
                                  "status",
                                  "reviewReason",
                                  "manualReview",
                                  "attempt",
                                  "reviewTarget",
                                  "projection",
                                  "retry",
                                  "attemptHistory",
                                  "responseQuestions"
                                ],
                                "properties": {
                                  "lessonKey": {
                                    "type": "string"
                                  },
                                  "lessonTitle": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "reviewReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "manualReview": {
                                    "type": "boolean"
                                  },
                                  "attempt": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "id",
                                      "number",
                                      "submittedAt",
                                      "formTitle",
                                      "resultReleasedAt"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "integer",
                                        "minimum": 1
                                      },
                                      "submittedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "formTitle": {
                                        "type": "string"
                                      },
                                      "resultReleasedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      }
                                    }
                                  },
                                  "reviewTarget": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "assignmentId",
                                          "lessonKey",
                                          "attemptId",
                                          "assessmentId",
                                          "courseVersionId",
                                          "releaseId",
                                          "formVersionId",
                                          "targetHash",
                                          "latestAttemptId",
                                          "isLatestAttempt"
                                        ],
                                        "properties": {
                                          "assignmentId": {
                                            "type": "string"
                                          },
                                          "lessonKey": {
                                            "type": "string"
                                          },
                                          "attemptId": {
                                            "type": "string"
                                          },
                                          "assessmentId": {
                                            "type": "string"
                                          },
                                          "courseVersionId": {
                                            "type": "string"
                                          },
                                          "releaseId": {
                                            "type": "string"
                                          },
                                          "formVersionId": {
                                            "type": "string"
                                          },
                                          "targetHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          },
                                          "latestAttemptId": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "isLatestAttempt": {
                                            "type": "boolean"
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "projection": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "earnedPoints",
                                          "possiblePoints",
                                          "passed"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string"
                                          },
                                          "earnedPoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "possiblePoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "passed": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "retry": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "canRetry",
                                          "exhausted",
                                          "attemptCount",
                                          "maxAttempts",
                                          "returnGrants"
                                        ],
                                        "properties": {
                                          "canRetry": {
                                            "type": "boolean"
                                          },
                                          "exhausted": {
                                            "type": "boolean"
                                          },
                                          "attemptCount": {
                                            "type": "integer",
                                            "minimum": 0
                                          },
                                          "maxAttempts": {
                                            "type": [
                                              "integer",
                                              "null"
                                            ],
                                            "minimum": 1
                                          },
                                          "returnGrants": {
                                            "type": "integer",
                                            "minimum": 0
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "attemptHistory": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "id",
                                        "number",
                                        "status",
                                        "submittedAt",
                                        "resultReleasedAt",
                                        "projection"
                                      ],
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "number": {
                                          "type": "integer",
                                          "minimum": 1
                                        },
                                        "status": {
                                          "type": "string"
                                        },
                                        "submittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "resultReleasedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "projection": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "state",
                                                "earnedPoints",
                                                "possiblePoints",
                                                "passed"
                                              ],
                                              "properties": {
                                                "state": {
                                                  "type": "string"
                                                },
                                                "earnedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "possiblePoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "passed": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "responseQuestions": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "questionId",
                                        "prompt",
                                        "answer",
                                        "responseText",
                                        "manualMaxPoints",
                                        "grade",
                                        "currentManualGrade"
                                      ],
                                      "properties": {
                                        "questionId": {
                                          "type": "string"
                                        },
                                        "prompt": {
                                          "type": "string"
                                        },
                                        "answer": {
                                          "description": "Immutable raw stored Native Forms answer value (string, number, boolean, string array, or null). Never a correct answer or key."
                                        },
                                        "responseText": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "manualMaxPoints": {
                                          "type": [
                                            "number",
                                            "null"
                                          ]
                                        },
                                        "grade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "correct",
                                                "awardedPoints",
                                                "maxPoints",
                                                "manuallyGraded"
                                              ],
                                              "properties": {
                                                "correct": {
                                                  "type": [
                                                    "boolean",
                                                    "null"
                                                  ]
                                                },
                                                "awardedPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "manuallyGraded": {
                                                  "type": "boolean"
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "currentManualGrade": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "awardedPoints",
                                                "maxPoints",
                                                "reason"
                                              ],
                                              "properties": {
                                                "awardedPoints": {
                                                  "type": "number"
                                                },
                                                "maxPoints": {
                                                  "type": [
                                                    "number",
                                                    "null"
                                                  ]
                                                },
                                                "reason": {
                                                  "type": [
                                                    "string",
                                                    "null"
                                                  ]
                                                }
                                              }
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "links": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/LmsCanonicalLink"
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "runs": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "items",
                            "nextCursor",
                            "hasMore"
                          ],
                          "properties": {
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "runNumber",
                                  "status",
                                  "startedAt",
                                  "submittedAt",
                                  "wrongCount",
                                  "unansweredCount"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "runNumber": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "startedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "wrongCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "unansweredCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  }
                                }
                              }
                            },
                            "nextCursor": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "hasMore": {
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Outcome does not match the canonical assignment, or stale revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/lms/retraining/modules": {
      "get": {
        "tags": [
          "lms"
        ],
        "operationId": "listLmsSkillGapModules",
        "summary": "List the org skill-gap module registry",
        "description": "Requires `lms:read`. Reusable published course modules for retraining, cursor-paged with explicit `hasMore`. Module content never carries worker identity or private case evidence.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page of skill-gap modules",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "modules",
                    "nextCursor",
                    "hasMore",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "modules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "organizationId",
                          "courseId",
                          "moduleKey",
                          "label",
                          "description",
                          "archivedAt",
                          "createdAt",
                          "courseTitle"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "organizationId": {
                            "type": "string"
                          },
                          "courseId": {
                            "type": "string"
                          },
                          "moduleKey": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "archivedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "courseTitle": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Cursor outside this authorized filtered result set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "lms"
        ],
        "operationId": "registerLmsSkillGapModule",
        "summary": "Register a published course module as a reusable skill-gap module",
        "description": "Requires `lms:write` and `Idempotency-Key`. The module must exist in the course’s current PUBLISHED version; registration upserts idempotently (relabel/unarchive) and never edits course content.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Stable operation key. Retrying the same mutation converges on the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "courseId",
                  "moduleKey",
                  "label"
                ],
                "properties": {
                  "courseId": {
                    "type": "string"
                  },
                  "moduleKey": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Registered skill-gap module",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "module",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "module": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "organizationId",
                        "courseId",
                        "moduleKey",
                        "label",
                        "description",
                        "archivedAt",
                        "createdAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "courseId": {
                          "type": "string"
                        },
                        "moduleKey": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when a same-key durable receipt replayed the original registration."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Course not published or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Module does not exist in the published version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists": {
      "get": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "listJobChecklists",
        "summary": "List a job's Task Checklist definitions",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Reports the per-job worker-visibility toggle; definitions stay listed and editable while it is off (enable is the final activation step).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobChecklistListResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistListResponse"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, surface, or organization denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "createJobChecklist",
        "summary": "Create a checklist with its complete draft",
        "description": "Requires `job_checklists:write`, a claimed token, the default-off job_checklists agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). One atomic call creates the COMPLETE draft (title + required + tree) — the receipt completes inside the create transaction, so a commit-then-crash retry replays the same definition instead of creating a twin.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "JobChecklistCreateResponse (replayed flags receipt replay)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistCreateResponse"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency key reused with a different payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/validate": {
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "validateJobChecklistInline",
        "summary": "Validate a local bundle without any definition (no writes)",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Runs the EXACT publish rule set over a caller-supplied bundle (title + required + tree); optional baselineDefinitionId adds the would-be publish impact and expectedDraftVersion reports base staleness without failing validation. Strictly zero writes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistValidateInlineRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobChecklistValidateResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistValidateResponse"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/reorder": {
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "reorderJobChecklists",
        "summary": "Strictly reorder the checklists of a job",
        "description": "Requires `job_checklists:write`, a claimed token, the default-off job_checklists agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). orderedDefinitionIds must contain EVERY definition exactly once; expectedOrderedDefinitionIds is a compare-and-set precondition on the current order — a mismatch is a typed 409 carrying the live order (reason ORDER_CHANGED).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistReorderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobChecklistReorderResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistReorderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Not a complete permutation of the job checklists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "ORDER_CHANGED with currentOrderedDefinitionIds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/capabilities": {
      "get": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "getJobChecklistCapabilities",
        "summary": "Task Checklist agent-surface capabilities",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Served operations, tree/answer limits, and (with ?jobId) the per-job toggle state.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobChecklistCapabilitiesResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistCapabilitiesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/submissions": {
      "get": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "listJobChecklistSubmissions",
        "summary": "List worker checklist submissions (privacy-filtered)",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Person-level evidence rows (worker identity + external task ids); filter by definitionId/userId/externalTaskId/versionNumber, fixed page size.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "definitionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalTaskId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "versionNumber",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobChecklistSubmissionsListResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistSubmissionsListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/submissions/{submissionId}": {
      "get": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "getJobChecklistSubmission",
        "summary": "Get one immutable submission",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Pinned version tree + active answers + exclusion-only inactive audit (no raw values, no value hashes). Missing, foreign, and unauthorized ids all read as the same opaque 404.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "submissionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobChecklistSubmissionGetResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistSubmissionGetResponse"
                }
              }
            }
          },
          "404": {
            "description": "Submission not found (opaque)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/jobs/{jobId}/settings": {
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "setJobChecklistsEnabled",
        "summary": "Enable or disable the per-job worker surface",
        "description": "Requires `job_checklists:write`, a claimed token, the default-off job_checklists agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). The toggle gates WORKER visibility only — authoring keeps working while off. Disabling requires confirmDisable: true (workers lose the checklist surface).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistSetEnabledRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobChecklistSetEnabledResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistSetEnabledResponse"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/{definitionId}": {
      "get": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "getJobChecklist",
        "summary": "Get one checklist builder detail",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Draft + published trees, CAS revisions (draftVersion, publishedVersionNumber), current issues, and the draft-vs-published impact. Opaque 404 for missing/foreign ids.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobChecklistGetResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistGetResponse"
                }
              }
            }
          },
          "404": {
            "description": "Checklist not found (opaque)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "manageJobChecklist",
        "summary": "Manage the draft lifecycle (CAS save, retire, restore)",
        "description": "Requires `job_checklists:write`, a claimed token, the default-off job_checklists agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). action=update_draft is an expectedDraftVersion-fenced save whose receipt completes inside the save transaction (crash-retries replay instead of 409ing against their own success); retire/restore set the worker-surface visibility of the definition.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistManageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobChecklistManageResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistManageResponse"
                }
              }
            }
          },
          "409": {
            "description": "Draft changed since load (CAS) or key reuse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/{definitionId}/validate": {
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "validateJobChecklist",
        "summary": "Validate a stored draft/published tree (no writes)",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. The EXACT publish rule set — the validate verdict can never drift from the publish verdict.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistValidateStoredRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobChecklistValidateResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistValidateResponse"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/{definitionId}/resolve": {
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "resolveJobChecklist",
        "summary": "Resolve supplied answers with the worker runtime (no writes)",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. The pure resolver over caller-supplied answers: visible rows, active answers, missing required paths, progress. The cross-surface conformance oracle; nothing is stored.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistResolveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobChecklistResolveResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistResolveResponse"
                }
              }
            }
          },
          "413": {
            "description": "Answers exceed the per-run byte cap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/{definitionId}/publish": {
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "publishJobChecklist",
        "summary": "Publish the draft as an immutable live version (confirmed)",
        "description": "Requires `job_checklists:write`, a claimed token, the default-off job_checklists agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). Double CAS (expectedDraftVersion + expectedPublishedVersionNumber; a mismatch is a typed 409 with the current number and content hash) plus confirmPublish: true. The response reports the APPLIED impact and exact stale-answer sweep counts; the receipt completes inside the publish transaction, so same-key crash-retries replay them exactly and can never double-publish.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistPublishRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobChecklistPublishResponse (applied impact + sweep counts)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistPublishResponse"
                }
              }
            }
          },
          "409": {
            "description": "PUBLISHED_VERSION_CHANGED / draft CAS / key reuse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/{definitionId}/versions": {
      "get": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "listJobChecklistVersions",
        "summary": "List immutable versions (bounded, newest first)",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Cursor-paginated (limit 1-100, default 25).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobChecklistVersionsListResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistVersionsListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/{definitionId}/versions/{versionNumber}": {
      "get": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "getJobChecklistVersion",
        "summary": "Get one immutable version with its frozen tree",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "versionNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobChecklistVersionGetResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistVersionGetResponse"
                }
              }
            }
          },
          "404": {
            "description": "Version not found (opaque)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-checklists/{definitionId}/preview-grant": {
      "post": {
        "tags": [
          "job-checklists"
        ],
        "operationId": "previewJobChecklistGrant",
        "summary": "Mint a stateless revision-exact browser preview link (no writes)",
        "description": "Requires `job_checklists:read`, a claimed token, and the default-off job_checklists agent surface. Read-classed capability mint: draft grants CAS expectedDraftVersion (typed 409 DRAFT_VERSION_CHANGED), published grants bind one immutable versionNumber, published-latest resolves it. The signed secret rides the returned URL FRAGMENT (never query strings or access logs), expires in minutes, and the browser exchange fails closed if the draft moved. Response is no-store.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobChecklistPreviewGrantRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "JobChecklistPreviewGrantResponse (previewUrl carries the fragment secret)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobChecklistPreviewGrantResponse"
                }
              }
            }
          },
          "409": {
            "description": "DRAFT_VERSION_CHANGED or no published version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback": {
      "get": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "listJobFeedback",
        "summary": "List a job's reviewer feedback reports (employer-only)",
        "description": "Requires `job_feedback:read`, a claimed token, the default-off job_feedback agent surface, and (except settings) Reviewer Feedback enabled for the job — a disabled toggle is a typed 409. Filters: status (or ALL), subject (a user id, or UNLINKED for legacy reports awaiting reconciliation), assessment (NEEDS_IMPROVEMENT includes legacy pre-assessment rows), lane (CONCERN|RECORDED; a concrete status or severity implies CONCERN and combined with lane=RECORDED is a 400), severity, reporter, search (case-insensitive substring over the report body), createdFrom/createdTo (ISO). Fixed page size with authoritative CONCERN-lane status counts plus recordedCount and assessment counts.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "IN_REVIEW",
                "ACTIONED",
                "DISMISSED",
                "ALL"
              ]
            }
          },
          {
            "name": "subject",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "A subject user id, or 'UNLINKED' for legacy unlinked reports."
          },
          {
            "name": "assessment",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "POSITIVE",
                "MIXED",
                "NEEDS_IMPROVEMENT"
              ]
            },
            "description": "DEV-3168 balanced filter; NEEDS_IMPROVEMENT includes legacy rows."
          },
          {
            "name": "lane",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "CONCERN",
                "RECORDED"
              ]
            },
            "description": "CONCERN = triage lifecycle rows; RECORDED = non-concern rows. RECORDED cannot combine with a concrete status or severity (400) — those filters imply CONCERN, and recorded rows would otherwise match through their MINOR/OPEN storage shadows."
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "MINOR",
                "MODERATE",
                "MAJOR",
                "CRITICAL"
              ]
            }
          },
          {
            "name": "reporter",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "createdFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time",
              "maxLength": 40
            },
            "description": "Inclusive lower bound. Full ISO-8601 timestamp with date, time, and timezone — date-only strings are a 400, and createdFrom > createdTo is a 400."
          },
          {
            "name": "createdTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time",
              "maxLength": 40
            },
            "description": "Inclusive upper bound. Full ISO-8601 timestamp with date, time, and timezone — date-only strings are a 400."
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobFeedbackListResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackListResponse"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, surface, or organization denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Reviewer Feedback is not enabled for this job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "submitJobFeedback",
        "summary": "Submit an employer-authored feedback report",
        "description": "Requires `job_feedback:write`, a claimed token, the default-off job_feedback agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). The subject must resolve to a person on the job roster (any contract; pass subjectContractId to pin one). The receipt completes inside the submit transaction, so a commit-then-crash retry replays the SAME report instead of filing a twin. DEV-3168 balanced shapes: omit assessment (legacy) and severity + report stay REQUIRED, recording a NEEDS_IMPROVEMENT concern; with assessment, severity present means a concern is flagged (POSITIVE never takes severity/suggestedAction; NEEDS_IMPROVEMENT requires severity; any flagged concern requires a report body). suggestedAction is a recommendation only — nothing executes automatically.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobFeedbackSubmitRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "JobFeedbackReportMutationResponse (replayed flags receipt replay)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackReportMutationResponse"
                }
              }
            }
          },
          "409": {
            "description": "Reviewer Feedback disabled for the job, or idempotency key reused with a different payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/summary": {
      "get": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "getJobFeedbackSummary",
        "summary": "Authoritative per-job feedback aggregates",
        "description": "Requires `job_feedback:read`, a claimed token, the default-off job_feedback agent surface, and (except settings) Reviewer Feedback enabled for the job — a disabled toggle is a typed 409. Server-computed aggregates — never derived from a loaded page: total count, unresolved CONCERN count, concern status counts, recordedCount, assessment counts, and per-person rollups with rating distributions, latest anchored rating, and rated-n-of-m. Ratings are sparse and optional — never average, score, or rank them.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobFeedbackSummaryResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackSummaryResponse"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Reviewer Feedback is not enabled for this job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/roster": {
      "get": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "listJobFeedbackRoster",
        "summary": "Canonical subject roster for the job (employer-only)",
        "description": "Requires `job_feedback:read`, a claimed token, the default-off job_feedback agent surface, and (except settings) Reviewer Feedback enabled for the job — a disabled toggle is a typed 409. Every person who holds (or held) a contract on the job with all their contracts — the id source for submit subjectUserId/subjectContractId and link-subject. Rehires appear as ONE person.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobFeedbackRosterResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackRosterResponse"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Reviewer Feedback is not enabled for this job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/{reportId}": {
      "get": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "getJobFeedbackReport",
        "summary": "Full report detail with its append-only event history",
        "description": "Requires `job_feedback:read`, a claimed token, the default-off job_feedback agent surface, and (except settings) Reviewer Feedback enabled for the job — a disabled toggle is a typed 409. Missing, foreign-tenant, and unauthorized report ids all read as the same opaque 404.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobFeedbackDetailResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackDetailResponse"
                }
              }
            }
          },
          "404": {
            "description": "Report not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/{reportId}/triage": {
      "post": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "triageJobFeedbackReport",
        "summary": "Move a report through its triage lifecycle (CAS-fenced)",
        "description": "Requires `job_feedback:write`, a claimed token, the default-off job_feedback agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). expectedUpdatedAt is REQUIRED on this surface — a stale token is a typed 409, so a concurrent web triage can never be silently overwritten. Completing (ACTIONED), closing (DISMISSED), and reopening a terminal report all require a note. The receipt completes inside the status transaction.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobFeedbackTriageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobFeedbackReportMutationResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackReportMutationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid transition or missing required note",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Report not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The report changed since you loaded it (stale expectedUpdatedAt)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/{reportId}/link-subject": {
      "post": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "linkJobFeedbackSubject",
        "summary": "Link a legacy unlinked report to its canonical person",
        "description": "Requires `job_feedback:write`, a claimed token, the default-off job_feedback agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). Audited one-way reconciliation: only reports with no subject accept a link (an already-linked report is a typed 409; every other subject change is blocked by the immutability trigger). Records a SUBJECT_LINKED event; the receipt completes inside the link transaction.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobFeedbackLinkSubjectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobFeedbackReportMutationResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackReportMutationResponse"
                }
              }
            }
          },
          "404": {
            "description": "Report not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "This report is already linked to a person",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/jobs/{jobId}/reviewer-access": {
      "get": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "listJobFeedbackReviewerAccess",
        "summary": "List reviewer-access candidates and grant state",
        "description": "Requires `job_feedback:read`, a claimed token, the default-off job_feedback agent surface, and (except settings) Reviewer Feedback enabled for the job — a disabled toggle is a typed 409. Unique people with an ACTIVE contract plus their explicit job-level grant state — the id source for grant/revoke targets.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobFeedbackReviewerAccessListResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackReviewerAccessListResponse"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Reviewer Feedback is not enabled for this job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "setJobFeedbackReviewerAccess",
        "summary": "Grant or revoke one reviewer feedback grant",
        "description": "Requires `job_feedback:write`, a claimed token, the default-off job_feedback agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). Absolute-state: grant=true upserts an active grant (requires an ACTIVE contract — a 400 otherwise), grant=false revokes (idempotent no-op when absent). The receipt completes inside the write transaction, so a crash-retry replays instead of re-stamping grant metadata. Historical reports and events are never touched.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobFeedbackReviewerAccessSetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobFeedbackReviewerAccessSetResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackReviewerAccessSetResponse"
                }
              }
            }
          },
          "400": {
            "description": "Grant target does not hold an active contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/jobs/{jobId}/reviewer-access/bulk": {
      "post": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "bulkJobFeedbackReviewerAccess",
        "summary": "Bulk grant/revoke reviewer feedback access (all-or-nothing)",
        "description": "Requires `job_feedback:write`, a claimed token, the default-off job_feedback agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). ONE transaction, never a client-side loop: one ineligible grant target fails the whole batch with nothing written (max 200 unique people; duplicates dedupe). Revokes are per-target no-ops when absent. The receipt completes inside the bulk transaction with the exact applied count, so a crash-retry replays the ORIGINAL updatedCount.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobFeedbackReviewerAccessBulkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobFeedbackReviewerAccessBulkResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackReviewerAccessBulkResponse"
                }
              }
            }
          },
          "400": {
            "description": "One or more grant targets lack an active contract (nothing changed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-feedback/jobs/{jobId}/settings": {
      "get": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "getJobFeedbackSettings",
        "summary": "Read the per-job Reviewer Feedback toggle",
        "description": "Requires `job_feedback:read`, a claimed token, and the default-off job_feedback agent surface. Works while the toggle is OFF — this is how an agent discovers whether the other operations are gated.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JobFeedbackSettingsResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackSettingsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-feedback"
        ],
        "operationId": "setJobFeedbackEnabled",
        "summary": "Enable or disable Reviewer Feedback for the job",
        "description": "Requires `job_feedback:write`, a claimed token, the default-off job_feedback agent surface, and `Idempotency-Key` (durable-receipt contract: same key + same payload replays the stored outcome). confirm: true is required in BOTH directions. Disabling hides the feature but preserves every report, audit event, subject link, and reviewer grant for re-enable. The receipt completes inside the toggle transaction; the response reports the state committed by this receipt and replays return the original outcome.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Stable operation key: 8-128 characters of letters, digits, dot, underscore, dash, or colon (durable-receipt contract). Retrying the same key with the same payload replays the stored receipt; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobFeedbackSetEnabledRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JobFeedbackSetEnabledResponse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFeedbackSetEnabledResponse"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (opaque for foreign tenants)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/context": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsContext",
        "summary": "Evidence-backed shared job context snapshot",
        "description": "Context-first entry point: objective/brief, active typed workflow, current decisions/policies/exceptions, external observations, latest checkpoint/handoff, open coordinated actions, bounded person page with display labels and readiness, counts, response signals, and inconsistencies at one coherent contextRevision. `view=compact` (default) includes completeness booleans for decisions, observations, actions, and people. `view=full` adds full per-person gate/evidence detail and recent events for the bounded page; it never implies a full roster unless `personsComplete=true`. Follow `nextPersonCursor` otherwise. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "compact",
                "full"
              ],
              "default": "compact"
            }
          },
          {
            "name": "personLimit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "personCursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "x-opentrain-job-ops-capabilities",
            "in": "header",
            "required": false,
            "description": "Comma-separated client capabilities (DEV-3079). `rule-health-reasons` adds `attention.ruleHealth[].healthReason` and `.incompleteSourceCounts`; without it those additive fields are omitted so already-published strict clients keep parsing. Unknown tokens are ignored.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coherent context snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One coherent evidence-backed context snapshot at exactly `contextRevision`. view=compact returns JobOpsPersonSummary roster entries; view=full returns JobOpsPersonProjection entries plus recentEvents/recentEventsComplete.",
                  "required": [
                    "jobId",
                    "contextExists",
                    "contextRevision",
                    "collectedAt",
                    "brief",
                    "workflow",
                    "activeDecisions",
                    "activeDecisionsComplete",
                    "latestCheckpoint",
                    "latestHandoff",
                    "counts",
                    "inconsistencies",
                    "responseSignals",
                    "attention",
                    "policies",
                    "guide",
                    "openActions",
                    "openActionsComplete",
                    "recentObservations",
                    "recentObservationsComplete",
                    "persons",
                    "personsTotal",
                    "personsComplete",
                    "nextPersonCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "contextExists": {
                      "type": "boolean"
                    },
                    "contextRevision": {
                      "type": "integer"
                    },
                    "collectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "brief": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "required": [
                        "id",
                        "briefRevision",
                        "objectiveText"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "briefRevision": {
                          "type": "integer"
                        },
                        "objectiveText": {
                          "type": "string"
                        }
                      }
                    },
                    "workflow": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkflowDefinition"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Null when no workflow is defined OR the stored definition is invalid; the INVALID_WORKFLOW_DEFINITION inconsistency distinguishes which."
                    },
                    "activeDecisions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsDecision"
                      }
                    },
                    "activeDecisionsComplete": {
                      "type": "boolean"
                    },
                    "latestCheckpoint": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsCheckpoint"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "latestHandoff": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsHandoff"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "required": [
                        "submittedProposals",
                        "openInvitations",
                        "activeContracts",
                        "milestonesActive",
                        "milestonesPendingApproval",
                        "workerObligationsOpen",
                        "trainingObligationsOpen",
                        "conversationsNeedingResponse",
                        "providersConfigured"
                      ],
                      "properties": {
                        "submittedProposals": {
                          "type": "integer"
                        },
                        "openInvitations": {
                          "type": "integer"
                        },
                        "activeContracts": {
                          "type": "integer"
                        },
                        "milestonesActive": {
                          "type": "integer"
                        },
                        "milestonesPendingApproval": {
                          "type": "integer"
                        },
                        "workerObligationsOpen": {
                          "type": "integer"
                        },
                        "trainingObligationsOpen": {
                          "type": "integer"
                        },
                        "conversationsNeedingResponse": {
                          "type": "integer"
                        },
                        "providersConfigured": {
                          "type": "integer"
                        }
                      }
                    },
                    "inconsistencies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "code",
                          "evidenceRefs"
                        ],
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "evidenceRefs": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/JobOpsEvidenceRef"
                            }
                          }
                        }
                      }
                    },
                    "responseSignals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "conversationId",
                          "threadId",
                          "needsEmployerResponse",
                          "lastMessageAt",
                          "evidenceRefs"
                        ],
                        "properties": {
                          "conversationId": {
                            "type": "string"
                          },
                          "threadId": {
                            "type": "string"
                          },
                          "needsEmployerResponse": {
                            "type": "boolean"
                          },
                          "lastMessageAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "evidenceRefs": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/JobOpsEvidenceRef"
                            }
                          }
                        }
                      }
                    },
                    "attention": {
                      "type": "object",
                      "description": "Bounded deterministic attention block (86d45zzzq): top 10 ACTIVE+FRESH actionable priorities (SHADOW rules excluded at the database query level; dismissed/live-snoozed triage excluded), full count metadata, and per-rule evaluator cursor health. STALE/INCOMPLETE conditions stay visible in the counts/health metadata but are never presented as actionable priorities.",
                      "required": [
                        "top",
                        "topComplete",
                        "counts",
                        "ruleHealth",
                        "shadowExcluded"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "top": {
                          "type": "array",
                          "maxItems": 10,
                          "items": {
                            "type": "object",
                            "required": [
                              "signalId",
                              "ruleKey",
                              "title",
                              "summary",
                              "priorityBand",
                              "priorityScore",
                              "freshness",
                              "effectiveTriage",
                              "occurrenceNumber",
                              "occurrenceStartedAt",
                              "lastEvaluatedAt",
                              "subjectPersonUserId",
                              "signalRevision",
                              "latestAction"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "signalId": {
                                "type": "string"
                              },
                              "ruleKey": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "summary": {
                                "type": "string"
                              },
                              "priorityBand": {
                                "type": "string",
                                "enum": [
                                  "P0",
                                  "P1",
                                  "P2",
                                  "P3"
                                ]
                              },
                              "priorityScore": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              },
                              "freshness": {
                                "type": "string",
                                "enum": [
                                  "FRESH"
                                ]
                              },
                              "effectiveTriage": {
                                "type": "string",
                                "enum": [
                                  "OPEN",
                                  "ACKNOWLEDGED"
                                ],
                                "description": "Only actionable triage appears here."
                              },
                              "occurrenceNumber": {
                                "type": "integer",
                                "minimum": 1
                              },
                              "occurrenceStartedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "lastEvaluatedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "subjectPersonUserId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "signalRevision": {
                                "type": "integer",
                                "description": "Send back as expectedSignalRevision on signal mutations."
                              },
                              "latestAction": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "description": "Derived ownership: the latest linked action attempt.",
                                    "required": [
                                      "actionId",
                                      "status",
                                      "attemptNumber",
                                      "claimOwner",
                                      "claimedByUserId",
                                      "claimedAt",
                                      "claimExpiresAt"
                                    ],
                                    "additionalProperties": false,
                                    "properties": {
                                      "actionId": {
                                        "type": "string"
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "OPEN",
                                          "CLAIMED",
                                          "COMPLETED",
                                          "CANCELED"
                                        ]
                                      },
                                      "attemptNumber": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ],
                                        "minimum": 1
                                      },
                                      "claimOwner": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      },
                                      "claimedByUserId": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      },
                                      "claimedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "claimExpiresAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            }
                          }
                        },
                        "topComplete": {
                          "type": "boolean"
                        },
                        "counts": {
                          "type": "object",
                          "required": [
                            "byCondition",
                            "activeByBand",
                            "activeByFreshness",
                            "activeByEffectiveTriage"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "byCondition": {
                              "type": "object",
                              "required": [
                                "ACTIVE",
                                "CLEARED"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "ACTIVE": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "CLEARED": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              }
                            },
                            "activeByBand": {
                              "type": "object",
                              "required": [
                                "P0",
                                "P1",
                                "P2",
                                "P3"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "P0": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "P1": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "P2": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "P3": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              }
                            },
                            "activeByFreshness": {
                              "type": "object",
                              "required": [
                                "FRESH",
                                "STALE",
                                "INCOMPLETE"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "FRESH": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "STALE": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "INCOMPLETE": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              }
                            },
                            "activeByEffectiveTriage": {
                              "type": "object",
                              "required": [
                                "OPEN",
                                "ACKNOWLEDGED",
                                "SNOOZED",
                                "DISMISSED"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "OPEN": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "ACKNOWLEDGED": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "SNOOZED": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "DISMISSED": {
                                  "type": "integer",
                                  "minimum": 0
                                }
                              }
                            }
                          }
                        },
                        "ruleHealth": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "ruleKey",
                              "ruleVersion",
                              "health",
                              "scanComplete",
                              "lastStartedAt",
                              "lastSuccessAt",
                              "lastFailureAt",
                              "consecutiveFailures",
                              "lastErrorCode",
                              "shadow"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "ruleKey": {
                                "type": "string"
                              },
                              "ruleVersion": {
                                "type": "integer",
                                "minimum": 1
                              },
                              "health": {
                                "type": "string",
                                "enum": [
                                  "HEALTHY",
                                  "STALE",
                                  "INCOMPLETE"
                                ],
                                "description": "Projected at read time from the stored cursor and the rule freshness SLA: a rule with no complete scan inside its SLA (INCOMPLETE too long, or still failing) or not started within its SLA plus a fixed 2-hour scheduling grace reads STALE. Stored evaluator state is never rewritten by a read."
                              },
                              "healthReason": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "FAILING",
                                  "INCOMPLETE_TOO_LONG",
                                  "NOT_EVALUATED_RECENTLY",
                                  "SCAN_IN_PROGRESS",
                                  "INCOMPLETE_SOURCES",
                                  "UNSUPPORTED",
                                  "SCAN_INCOMPLETE",
                                  null
                                ],
                                "description": "Present only when the request opts in with header `x-opentrain-job-ops-capabilities: rule-health-reasons` (omitted otherwise so already-published strict clients keep parsing). Why health is what it is (null = HEALTHY with no failure). FAILING = the latest evaluation failed (see consecutiveFailures/lastErrorCode; STALE once past the SLA); INCOMPLETE_TOO_LONG = STALE, the evaluator runs but no complete scan landed within the SLA; NOT_EVALUATED_RECENTLY = STALE, the evaluator has not started the rule recently (scheduling); SCAN_IN_PROGRESS / INCOMPLETE_SOURCES / UNSUPPORTED / SCAN_INCOMPLETE = INCOMPLETE inside the SLA. The enum is closed for this capability: any new value ships behind a NEW capability token, so a client that sent only `rule-health-reasons` never receives it."
                              },
                              "scanComplete": {
                                "type": "boolean"
                              },
                              "lastStartedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "lastSuccessAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "lastFailureAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "consecutiveFailures": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "lastErrorCode": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Privacy-safe error class only — never payloads."
                              },
                              "incompleteSourceCounts": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "description": "Present only with the `rule-health-reasons` capability header (see healthReason). Source records the last finished scan could not read, as privacy-safe reason code -> count (never ids, answers, or names); null when none are stored. Distinguishes a data/classification problem from a scan delay. The code set is closed for this capability: any new code ships behind a NEW capability token, so a client that sent only `rule-health-reasons` never receives it.",
                                "additionalProperties": false,
                                "properties": {
                                  "FORM_DEFINITION_UNPARSEABLE": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "FORM_DEFINITION_MISSING": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "GRADE_RECORD_INVALID": {
                                    "type": "integer",
                                    "minimum": 1
                                  },
                                  "GRADE_RECORD_MISSING": {
                                    "type": "integer",
                                    "minimum": 1
                                  }
                                }
                              },
                              "shadow": {
                                "type": "boolean"
                              }
                            }
                          }
                        },
                        "shadowExcluded": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        }
                      }
                    },
                    "policies": {
                      "type": "object",
                      "description": "Effective typed-policy summary (fail closed: complete=false with an empty effective set when history exceeded the bounded read — use the policies endpoints for detail).",
                      "required": [
                        "complete",
                        "effective",
                        "storedInvalidKeys",
                        "legacyUntypedPolicyCount",
                        "pendingExternalEnforcementKeys"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "complete": {
                          "type": "boolean"
                        },
                        "effective": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "key",
                              "family",
                              "policyRevision",
                              "schemaVersion",
                              "enforcementTarget",
                              "enforcementStatus",
                              "decisionId",
                              "supersedesDecisionId",
                              "effectiveAt",
                              "expiresAt"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "family": {
                                "type": "string",
                                "enum": [
                                  "OPERATING_RULE",
                                  "TRAINING_PRODUCTION_GATE",
                                  "WORKFLOW_GATE_RULE",
                                  "WORK_DEFINITION_APPROVAL",
                                  "WORK_DUPLICATE_RESOLUTION",
                                  "WORK_COORDINATION_MODE"
                                ]
                              },
                              "policyRevision": {
                                "type": "integer",
                                "minimum": 1
                              },
                              "schemaVersion": {
                                "type": "integer",
                                "minimum": 1
                              },
                              "enforcementTarget": {
                                "type": "string",
                                "enum": [
                                  "GUIDE",
                                  "WORKFLOW",
                                  "CANONICAL_DB",
                                  "EXTERNAL"
                                ]
                              },
                              "enforcementStatus": {
                                "type": "string",
                                "enum": [
                                  "APPLIED",
                                  "PENDING_ENFORCEMENT",
                                  "DRIFTED",
                                  "NOT_APPLICABLE"
                                ]
                              },
                              "decisionId": {
                                "type": "string"
                              },
                              "supersedesDecisionId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "effectiveAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "expiresAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            }
                          }
                        },
                        "storedInvalidKeys": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "legacyUntypedPolicyCount": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "pendingExternalEnforcementKeys": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "guide": {
                      "type": "object",
                      "description": "Agent Guide digest (canonical projection guideVersion + checksum) computed from the same fenced reads as this snapshot: fetch the agent-guide endpoint for the full document; compare checksums to detect change.",
                      "required": [
                        "schemaVersion",
                        "guideVersion",
                        "checksum",
                        "lastMaterialChangeAt"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "schemaVersion": {
                          "type": "integer",
                          "enum": [
                            1
                          ]
                        },
                        "guideVersion": {
                          "type": "integer"
                        },
                        "checksum": {
                          "type": "string"
                        },
                        "lastMaterialChangeAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "openActions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsAction"
                      }
                    },
                    "openActionsComplete": {
                      "type": "boolean"
                    },
                    "recentObservations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsObservation"
                      }
                    },
                    "recentObservationsComplete": {
                      "type": "boolean"
                    },
                    "recentEvents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvent"
                      },
                      "description": "view=full only."
                    },
                    "recentEventsComplete": {
                      "type": "boolean",
                      "description": "view=full only."
                    },
                    "persons": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/JobOpsPersonSummary"
                          },
                          {
                            "$ref": "#/components/schemas/JobOpsPersonProjection"
                          }
                        ]
                      }
                    },
                    "personsTotal": {
                      "type": "integer",
                      "description": "Full-roster size; counts/summaries always reflect the full roster."
                    },
                    "personsComplete": {
                      "type": "boolean"
                    },
                    "nextPersonCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/delta": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsDelta",
        "summary": "Context events after an acknowledged revision",
        "description": "Revision-cursor delta stream with truthful paging: `hasMore` reports whether more events exist and `nextRevision` is the last DELIVERED revision (safe resume point — never skips events). Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "sinceRevision",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ordered events strictly after sinceRevision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One closed revision-cursor page. Events use the same privacy-safe shape as full-context recentEvents.",
                  "required": [
                    "contextRevision",
                    "events",
                    "hasMore",
                    "nextRevision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "description": "Current head revision of the context."
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvent"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextRevision": {
                      "type": "integer",
                      "description": "The last revision actually delivered in this page — the safe resume point."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/people/{personUserId}": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsPerson",
        "summary": "One evidence-backed person detail",
        "description": "A focused read for one roster person: lifecycle, readiness, raw/operative gates with evidence, screening verdict, training progress, payment state, scoped actions, and scoped active decisions. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "personUserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Person detail at a coherent revision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One evidence-backed person read at a coherent contextRevision, with scoped open/claimed actions and scoped active decisions.",
                  "required": [
                    "jobId",
                    "contextRevision",
                    "collectedAt",
                    "person",
                    "actions",
                    "actionsComplete",
                    "decisions",
                    "decisionsComplete",
                    "observationsComplete",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "contextRevision": {
                      "type": "integer"
                    },
                    "collectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "person": {
                      "$ref": "#/components/schemas/JobOpsPersonProjection"
                    },
                    "actions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsAction"
                      }
                    },
                    "actionsComplete": {
                      "type": "boolean"
                    },
                    "decisions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsDecision"
                      }
                    },
                    "decisionsComplete": {
                      "type": "boolean"
                    },
                    "observationsComplete": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/actions": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsActions",
        "summary": "List coordinated actions with claim/lease detail",
        "description": "Paged owner/lease/due/dependency/evidence detail; filter by `status` and follow `nextCursor` while `hasMore=true`. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "CLAIMED",
                "COMPLETED",
                "CANCELED"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paged actions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "actions",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "contextRevision": {
                      "type": "integer"
                    },
                    "actions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsAction"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "createJobOperationsAction",
        "summary": "Create a coordinated action",
        "description": "Creates an OPEN coordination action (optionally person-scoped; subjects must be canonical participants of this exact job). Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "title"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "LOW",
                      "NORMAL",
                      "HIGH",
                      "URGENT"
                    ],
                    "default": "NORMAL"
                  },
                  "subjectPersonUserId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "Must be a canonical participant of this exact job."
                  },
                  "assignedOwner": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Intended owner (person or agent label) — advisory until claimed."
                  },
                  "dueAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "dependsOnActionIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Same-context action ids that must be COMPLETED before this one is claimable."
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (or replayed) action",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe coordination action with exact claim/lease/dependency/evidence detail.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "titleText",
                    "descriptionText",
                    "statusText",
                    "priorityText",
                    "subjectPersonUserId",
                    "assignedOwnerText",
                    "dueAt",
                    "dependsOnJson",
                    "evidenceRefsJson",
                    "claimOwnerText",
                    "claimedByUserId",
                    "claimedAt",
                    "claimExpiresAt",
                    "completedAt",
                    "completedByText",
                    "outcomeText",
                    "canceledAt",
                    "canceledByUserId",
                    "createdByUserId",
                    "sourceSignalId",
                    "signalActionAttemptNumber",
                    "workExecutionId",
                    "handoffReservedForUserId",
                    "handoffReservedByUserId",
                    "handoffReservationExpiresAt",
                    "handoffReservationHandoffId",
                    "handoffReservationInstructions",
                    "revision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "descriptionText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "statusText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "CLAIMED",
                        "COMPLETED",
                        "CANCELED"
                      ]
                    },
                    "priorityText": {
                      "type": "string",
                      "enum": [
                        "LOW",
                        "NORMAL",
                        "HIGH",
                        "URGENT"
                      ]
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignedOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "dueAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "dependsOnJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "description": "Same-context action ids this action depends on."
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "claimOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "claimExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedByText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outcomeText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canceledAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "canceledByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sourceSignalId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
                    },
                    "signalActionAttemptNumber": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "workExecutionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
                    },
                    "handoffReservedForUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
                    },
                    "handoffReservedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "handoffReservationHandoffId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationInstructions": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
                      "additionalProperties": false,
                      "required": [
                        "summary",
                        "openItems",
                        "evidenceRefs"
                      ],
                      "properties": {
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 10000
                        },
                        "openItems": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "evidenceRefs": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/JobOpsEvidenceRef"
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current action revision — send back as expectedActionRevision."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/actions/{actionId}/claim": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "claimJobOperationsAction",
        "summary": "Claim an action with a lease",
        "description": "Claims an OPEN action (or takes over an EXPIRED lease) under `expectedActionRevision` optimistic concurrency; returns a claim receipt required by release/complete. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedActionRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedActionRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current action revision — the per-action optimistic concurrency fence."
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  },
                  "leaseSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 14400,
                    "default": 900,
                    "description": "Out-of-range leases are rejected, not clamped."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Claimed action with its receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "A claimed privacy-safe action plus its signed receipt and replay marker.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "titleText",
                    "descriptionText",
                    "statusText",
                    "priorityText",
                    "subjectPersonUserId",
                    "assignedOwnerText",
                    "dueAt",
                    "dependsOnJson",
                    "evidenceRefsJson",
                    "claimOwnerText",
                    "claimedByUserId",
                    "claimedAt",
                    "claimExpiresAt",
                    "completedAt",
                    "completedByText",
                    "outcomeText",
                    "canceledAt",
                    "canceledByUserId",
                    "createdByUserId",
                    "sourceSignalId",
                    "signalActionAttemptNumber",
                    "workExecutionId",
                    "handoffReservedForUserId",
                    "handoffReservedByUserId",
                    "handoffReservationExpiresAt",
                    "handoffReservationHandoffId",
                    "handoffReservationInstructions",
                    "revision",
                    "claimReceipt",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "descriptionText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "statusText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "CLAIMED",
                        "COMPLETED",
                        "CANCELED"
                      ]
                    },
                    "priorityText": {
                      "type": "string",
                      "enum": [
                        "LOW",
                        "NORMAL",
                        "HIGH",
                        "URGENT"
                      ]
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignedOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "dueAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "dependsOnJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "description": "Same-context action ids this action depends on."
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "claimOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "claimExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedByText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outcomeText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canceledAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "canceledByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sourceSignalId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
                    },
                    "signalActionAttemptNumber": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "workExecutionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
                    },
                    "handoffReservedForUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
                    },
                    "handoffReservedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "handoffReservationHandoffId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationInstructions": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
                      "additionalProperties": false,
                      "required": [
                        "summary",
                        "openItems",
                        "evidenceRefs"
                      ],
                      "properties": {
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 10000
                        },
                        "openItems": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "evidenceRefs": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/JobOpsEvidenceRef"
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current action revision — send back as expectedActionRevision."
                    },
                    "claimReceipt": {
                      "type": "string",
                      "description": "Signed receipt required by release/complete for this claim."
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/actions/{actionId}/release": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "releaseJobOperationsAction",
        "summary": "Release a claimed action",
        "description": "Releases the caller’s claim using its claim receipt so other actors can pick the work up. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedActionRevision",
                  "claimReceipt"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedActionRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current action revision — the per-action optimistic concurrency fence."
                  },
                  "claimReceipt": {
                    "type": "string",
                    "minLength": 1
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Released action",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe coordination action with exact claim/lease/dependency/evidence detail.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "titleText",
                    "descriptionText",
                    "statusText",
                    "priorityText",
                    "subjectPersonUserId",
                    "assignedOwnerText",
                    "dueAt",
                    "dependsOnJson",
                    "evidenceRefsJson",
                    "claimOwnerText",
                    "claimedByUserId",
                    "claimedAt",
                    "claimExpiresAt",
                    "completedAt",
                    "completedByText",
                    "outcomeText",
                    "canceledAt",
                    "canceledByUserId",
                    "createdByUserId",
                    "sourceSignalId",
                    "signalActionAttemptNumber",
                    "workExecutionId",
                    "handoffReservedForUserId",
                    "handoffReservedByUserId",
                    "handoffReservationExpiresAt",
                    "handoffReservationHandoffId",
                    "handoffReservationInstructions",
                    "revision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "descriptionText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "statusText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "CLAIMED",
                        "COMPLETED",
                        "CANCELED"
                      ]
                    },
                    "priorityText": {
                      "type": "string",
                      "enum": [
                        "LOW",
                        "NORMAL",
                        "HIGH",
                        "URGENT"
                      ]
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignedOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "dueAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "dependsOnJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "description": "Same-context action ids this action depends on."
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "claimOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "claimExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedByText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outcomeText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canceledAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "canceledByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sourceSignalId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
                    },
                    "signalActionAttemptNumber": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "workExecutionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
                    },
                    "handoffReservedForUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
                    },
                    "handoffReservedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "handoffReservationHandoffId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationInstructions": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
                      "additionalProperties": false,
                      "required": [
                        "summary",
                        "openItems",
                        "evidenceRefs"
                      ],
                      "properties": {
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 10000
                        },
                        "openItems": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "evidenceRefs": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/JobOpsEvidenceRef"
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current action revision — send back as expectedActionRevision."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/actions/{actionId}/complete": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "completeJobOperationsAction",
        "summary": "Complete a claimed action",
        "description": "Completes the caller’s claimed action with its claim receipt and an optional outcome note. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedActionRevision",
                  "claimReceipt"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedActionRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current action revision — the per-action optimistic concurrency fence."
                  },
                  "claimReceipt": {
                    "type": "string",
                    "minLength": 1
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  },
                  "outcome": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "resultEvidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed action",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe coordination action with exact claim/lease/dependency/evidence detail.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "titleText",
                    "descriptionText",
                    "statusText",
                    "priorityText",
                    "subjectPersonUserId",
                    "assignedOwnerText",
                    "dueAt",
                    "dependsOnJson",
                    "evidenceRefsJson",
                    "claimOwnerText",
                    "claimedByUserId",
                    "claimedAt",
                    "claimExpiresAt",
                    "completedAt",
                    "completedByText",
                    "outcomeText",
                    "canceledAt",
                    "canceledByUserId",
                    "createdByUserId",
                    "sourceSignalId",
                    "signalActionAttemptNumber",
                    "workExecutionId",
                    "handoffReservedForUserId",
                    "handoffReservedByUserId",
                    "handoffReservationExpiresAt",
                    "handoffReservationHandoffId",
                    "handoffReservationInstructions",
                    "revision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "descriptionText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "statusText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "CLAIMED",
                        "COMPLETED",
                        "CANCELED"
                      ]
                    },
                    "priorityText": {
                      "type": "string",
                      "enum": [
                        "LOW",
                        "NORMAL",
                        "HIGH",
                        "URGENT"
                      ]
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignedOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "dueAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "dependsOnJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "description": "Same-context action ids this action depends on."
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "claimOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "claimExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedByText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outcomeText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canceledAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "canceledByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sourceSignalId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
                    },
                    "signalActionAttemptNumber": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "workExecutionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
                    },
                    "handoffReservedForUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
                    },
                    "handoffReservedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "handoffReservationHandoffId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationInstructions": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
                      "additionalProperties": false,
                      "required": [
                        "summary",
                        "openItems",
                        "evidenceRefs"
                      ],
                      "properties": {
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 10000
                        },
                        "openItems": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "evidenceRefs": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/JobOpsEvidenceRef"
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current action revision — send back as expectedActionRevision."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/actions/{actionId}/cancel": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "cancelJobOperationsAction",
        "summary": "Cancel a non-terminal action",
        "description": "Cancels OPEN or CLAIMED work (superseded plans, duplicates); terminal states are immutable. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedActionRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedActionRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current action revision — the per-action optimistic concurrency fence."
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "resultEvidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canceled action",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe coordination action with exact claim/lease/dependency/evidence detail.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "titleText",
                    "descriptionText",
                    "statusText",
                    "priorityText",
                    "subjectPersonUserId",
                    "assignedOwnerText",
                    "dueAt",
                    "dependsOnJson",
                    "evidenceRefsJson",
                    "claimOwnerText",
                    "claimedByUserId",
                    "claimedAt",
                    "claimExpiresAt",
                    "completedAt",
                    "completedByText",
                    "outcomeText",
                    "canceledAt",
                    "canceledByUserId",
                    "createdByUserId",
                    "sourceSignalId",
                    "signalActionAttemptNumber",
                    "workExecutionId",
                    "handoffReservedForUserId",
                    "handoffReservedByUserId",
                    "handoffReservationExpiresAt",
                    "handoffReservationHandoffId",
                    "handoffReservationInstructions",
                    "revision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "descriptionText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "statusText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "CLAIMED",
                        "COMPLETED",
                        "CANCELED"
                      ]
                    },
                    "priorityText": {
                      "type": "string",
                      "enum": [
                        "LOW",
                        "NORMAL",
                        "HIGH",
                        "URGENT"
                      ]
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignedOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "dueAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "dependsOnJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "description": "Same-context action ids this action depends on."
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "claimOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "claimExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedByText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outcomeText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canceledAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "canceledByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sourceSignalId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
                    },
                    "signalActionAttemptNumber": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "workExecutionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
                    },
                    "handoffReservedForUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
                    },
                    "handoffReservedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "handoffReservationHandoffId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationInstructions": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
                      "additionalProperties": false,
                      "required": [
                        "summary",
                        "openItems",
                        "evidenceRefs"
                      ],
                      "properties": {
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 10000
                        },
                        "openItems": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "evidenceRefs": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/JobOpsEvidenceRef"
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current action revision — send back as expectedActionRevision."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/sweep": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "runJobOperationsSweep",
        "summary": "Reconcile the context from the platform outbox",
        "description": "Bounded idempotent sweep folding unwired canonical mutations into the context. The resume cursor is durable and SERVER-owned — callers never track the global outbox cursor. When `hasMore=true`, call again with this response’s `contextRevision`; after `hasMore=false`, read context again. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "sinceEventId": {
                    "type": "string",
                    "pattern": "^\\d+$",
                    "deprecated": true,
                    "description": "Ignored: the durable server-owned cursor is always authoritative. Accepted only for backward-compatible request parsing."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "default": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sweep receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Bounded idempotent sweep receipt. The resume cursor is durable and server-owned; while hasMore=true call sweep again with this contextRevision, then read context again.",
                  "required": [
                    "contextRevision",
                    "scanned",
                    "advanced",
                    "replayed",
                    "skipped",
                    "lastEventId",
                    "cursor",
                    "hasMore",
                    "driftAdvanced",
                    "driftReplayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "description": "Context revision observed after this bounded sweep — use it for the next continuation call."
                    },
                    "scanned": {
                      "type": "integer"
                    },
                    "advanced": {
                      "type": "integer"
                    },
                    "replayed": {
                      "type": "integer"
                    },
                    "skipped": {
                      "type": "integer"
                    },
                    "lastEventId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "High-water mark of every scanned outbox row; null when the page was empty."
                    },
                    "cursor": {
                      "type": "string",
                      "description": "The durable server-owned outbox cursor after this sweep (informational)."
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "driftAdvanced": {
                      "type": "integer"
                    },
                    "driftReplayed": {
                      "type": "integer"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/brief": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "publishJobOperationsBrief",
        "summary": "Publish the objective and typed workflow",
        "description": "Publishes the next brief revision: the job objective plus the versioned typed workflow definition (explicit gate source bindings; malformed definitions fail closed). Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "objective"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "objective": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000
                  },
                  "workflowDefinition": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/JobOpsWorkflowDefinition"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Versioned typed workflow contract, validated in depth by the service; malformed definitions fail closed with 400."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Published (or replayed) brief",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe published brief revision.",
                  "required": [
                    "id",
                    "briefRevision",
                    "objectiveText",
                    "workflowDefinitionJson",
                    "createdAt",
                    "createdByUserId",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "briefRevision": {
                      "type": "integer"
                    },
                    "objectiveText": {
                      "type": "string"
                    },
                    "workflowDefinitionJson": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkflowDefinition"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/decisions": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsDecisions",
        "summary": "Paged decision/policy/exception history",
        "description": "Newest-first history where every record carries its effective status (ACTIVE, SUPERSEDED, EXPIRED, SCHEDULED). Filter by explicit reduced-audience `visibility`; page with `cursor`/`limit`. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "visibility",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "INTERNAL",
                "CLIENT_SAFE",
                "WORKER_SAFE"
              ]
            },
            "description": "Explicit reduced-audience filter: returns ONLY records marked with exactly this visibility. Omitted = the full internal view."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paged decision history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "A bounded newest-first page of durable decision history.",
                  "required": [
                    "contextRevision",
                    "decisions",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer"
                    },
                    "decisions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsDecisionHistoryRow"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "recordJobOperationsDecision",
        "summary": "Record a policy, decision, or approved exception",
        "description": "Durable manual memory: policies, decisions, and person-scoped exceptions with optional readiness effects over OPERATIVE gates (raw evidence is never rewritten; IDENTITY/LOCATION are never waivable). Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "kind",
                  "title"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "POLICY",
                      "DECISION",
                      "EXCEPTION"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "body": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "INTERNAL",
                      "CLIENT_SAFE",
                      "WORKER_SAFE"
                    ],
                    "default": "INTERNAL"
                  },
                  "scopePersonUserId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "Must be a canonical participant of this exact job."
                  },
                  "gateKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "readinessEffect": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "PASS",
                      "FAIL",
                      "HOLD"
                    ],
                    "default": "NONE",
                    "description": "Any effect other than NONE must name both gateKey and scopePersonUserId. PASS decisions against the non-waivable IDENTITY/LOCATION gates are recorded but ignored."
                  },
                  "effectiveAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "expiresAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "Must be after effectiveAt; null = until superseded."
                  },
                  "supersedesDecisionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "Same-context decision to supersede (linear supersession — one successor)."
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded (or replayed) decision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe durable policy/decision/exception record.",
                  "required": [
                    "id",
                    "kindText",
                    "titleText",
                    "bodyText",
                    "visibilityText",
                    "scopePersonUserId",
                    "gateKeyText",
                    "readinessEffectText",
                    "effectiveAt",
                    "expiresAt",
                    "supersedesDecisionId",
                    "evidenceRefsJson",
                    "createdAt",
                    "createdByUserId",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "kindText": {
                      "type": "string",
                      "enum": [
                        "POLICY",
                        "DECISION",
                        "EXCEPTION"
                      ]
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "bodyText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "visibilityText": {
                      "type": "string",
                      "enum": [
                        "INTERNAL",
                        "CLIENT_SAFE",
                        "WORKER_SAFE"
                      ]
                    },
                    "scopePersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "gateKeyText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "readinessEffectText": {
                      "type": "string",
                      "enum": [
                        "NONE",
                        "PASS",
                        "FAIL",
                        "HOLD"
                      ]
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "supersedesDecisionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/observations": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsObservations",
        "summary": "Paged observation history",
        "description": "Newest-observed-first history with explicit authority and visibility on every record; filter by `subjectPersonUserId` or explicit `visibility`; page with `cursor`/`limit`. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "subjectPersonUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "visibility",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "INTERNAL",
                "CLIENT_SAFE",
                "WORKER_SAFE"
              ]
            },
            "description": "Explicit reduced-audience filter: returns ONLY records marked with exactly this visibility. Omitted = the full internal view."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paged observation history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "observations",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "contextRevision": {
                      "type": "integer"
                    },
                    "observations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsObservation"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "recordJobOperationsObservation",
        "summary": "Record an external observation",
        "description": "Durable external evidence with OBSERVED/INFERRED/RECOMMENDED authority and an optional typed gate signal. Never duplicate ordinary canonical facts as observations. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "authority",
                  "title"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "authority": {
                    "type": "string",
                    "enum": [
                      "OBSERVED",
                      "INFERRED",
                      "RECOMMENDED"
                    ],
                    "description": "DERIVED belongs to projections and DECIDED to decisions — not assertable here."
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "INTERNAL",
                      "CLIENT_SAFE",
                      "WORKER_SAFE"
                    ],
                    "default": "INTERNAL"
                  },
                  "subjectPersonUserId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "Must be a canonical participant of this exact job."
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "body": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "observedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "gateSignal": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/JobOpsGateSignal"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "metadata": {
                    "type": "object",
                    "description": "Free-form metadata. The externalAttestation key is reserved (refused); pass the top-level field."
                  },
                  "externalAttestation": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/JobOpsExternalAttestation"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "DEV-3191 Phase 5 (RC9): requires OBSERVED authority; the same-context lineage proof runs before any write."
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded (or replayed) observation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe durable external observation with explicit authority and visibility. A write may add a parsed safe `gateSignal`; raw metadata never crosses the boundary.",
                  "required": [
                    "id",
                    "authorityText",
                    "visibilityText",
                    "subjectPersonUserId",
                    "titleText",
                    "bodyText",
                    "observedAt",
                    "createdAt",
                    "createdByUserId",
                    "createdByAgentText",
                    "evidenceRefsJson",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "authorityText": {
                      "type": "string",
                      "enum": [
                        "OBSERVED",
                        "INFERRED",
                        "RECOMMENDED"
                      ]
                    },
                    "visibilityText": {
                      "type": "string",
                      "enum": [
                        "INTERNAL",
                        "CLIENT_SAFE",
                        "WORKER_SAFE"
                      ]
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "bodyText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "observedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "createdByAgentText": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "DEV-3191 Phase 5 (RC9): canonical executing-agent attribution (server-normalized from actorAgentLabel; null for a human or legacy row)."
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "gateSignal": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsGateSignal"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "externalAttestation": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsExternalAttestation"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Present on the record result: the closed parsed attestation slot, or null (a poisoned stored slot reads null — raw metadata never crosses the boundary)."
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/checkpoints": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "acknowledgeJobOperationsCheckpoint",
        "summary": "Acknowledge a context revision",
        "description": "Records the delta cursor an actor has fully processed. Checkpoints never advance the context revision. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "acknowledgedRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "acknowledgedRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Must not exceed the current context revision."
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded (or replayed) checkpoint",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe delta-cursor acknowledgement. Checkpoints never advance the context revision.",
                  "required": [
                    "id",
                    "acknowledgedRevision",
                    "actorUserId",
                    "actorAgentText",
                    "noteText",
                    "createdAt",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "acknowledgedRevision": {
                      "type": "integer"
                    },
                    "actorUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "actorAgentText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "noteText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/handoffs": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "recordJobOperationsHandoff",
        "summary": "Record a structured handoff",
        "description": "Ends a session with a structured summary, open items, and an optional recipient. Human recipients must be in this job’s authorized employer court; agent labels stay labels. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "summary"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "summary": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "basedOnRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The context revision the departing actor last saw; rejected when ahead of the context. Omitted = the current head revision."
                  },
                  "fromActorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  },
                  "toActorUserId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "Human recipient — must be in this job’s authorized employer court."
                  },
                  "toActorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  },
                  "openItems": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded (or replayed) handoff",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One privacy-safe structured handoff. contextRevision is the revision the departing actor had seen; the handoff event advances the context one step past it.",
                  "required": [
                    "id",
                    "fromActorUserId",
                    "fromActorAgentText",
                    "toActorUserId",
                    "toActorAgentText",
                    "summaryText",
                    "openItemsJson",
                    "contextRevision",
                    "evidenceRefsJson",
                    "createdAt",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "fromActorUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fromActorAgentText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "toActorUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "toActorAgentText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "summaryText": {
                      "type": "string"
                    },
                    "openItemsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      }
                    },
                    "contextRevision": {
                      "type": "integer"
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/signals": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsSignals",
        "summary": "List deterministic attention signals",
        "description": "Attention signals for this job, highest priority first, with condition/freshness/triage/ruleKey filters. SHADOW-rule signals are omitted at the database query level unless `includeShadow=true` (explicit audit read); an explicit shadow ruleKey filter without includeShadow reads as empty rather than leaking onto the default feed. An expired snooze reads as effective triage OPEN without a write. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "condition",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "CLEARED"
              ]
            }
          },
          {
            "name": "freshness",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "FRESH",
                "STALE",
                "INCOMPLETE"
              ]
            }
          },
          {
            "name": "triage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "ACKNOWLEDGED",
                "SNOOZED",
                "DISMISSED"
              ]
            },
            "description": "Filters on STORED triage; effective triage is derived per row."
          },
          {
            "name": "ruleKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          {
            "name": "includeShadow",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "default": "false"
            },
            "description": "Explicit audit read of persisted SHADOW-rule signals. Shadow signals never drive default priority or claim flows."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded signal page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One bounded signal page, highest priority first. SHADOW-rule signals are omitted at the database query level unless includeShadow=true.",
                  "required": [
                    "contextRevision",
                    "signals",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer"
                    },
                    "signals": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsSignal"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/signals/{signalId}": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsSignal",
        "summary": "Attention signal detail with derived ownership",
        "description": "One signal head plus the latest linked action attempt (the derived owner/claim state). Cross-context and nonexistent ids read identically as 404. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "signalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Signal detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Signal detail plus the latest linked action attempt — the derived owner/claim state.",
                  "required": [
                    "contextRevision",
                    "signal",
                    "latestAction",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer"
                    },
                    "signal": {
                      "$ref": "#/components/schemas/JobOpsSignal"
                    },
                    "latestAction": {
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "id",
                            "statusText",
                            "signalActionAttemptNumber",
                            "claimOwnerText",
                            "claimedByUserId",
                            "claimedAt",
                            "claimExpiresAt",
                            "completedAt",
                            "canceledAt",
                            "revision"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "statusText": {
                              "type": "string",
                              "enum": [
                                "OPEN",
                                "CLAIMED",
                                "COMPLETED",
                                "CANCELED"
                              ]
                            },
                            "signalActionAttemptNumber": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 1
                            },
                            "claimOwnerText": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "claimedByUserId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "claimedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "claimExpiresAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "completedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "canceledAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "revision": {
                              "type": "integer"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/signals/{signalId}/acknowledge": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "acknowledgeJobOperationsSignal",
        "summary": "Acknowledge an active signal",
        "description": "Marks an ACTIVE signal ACKNOWLEDGED (seen, still actionable). Triage never claims work and never clears the condition — only the evaluator clears. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "signalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedSignalRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedSignalRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current signal revision — the per-signal optimistic concurrency fence."
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Triaged signal (presented row plus replayed flag)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The exact presented signal row plus the idempotency replay marker.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "ruleKeyText",
                    "ruleVersion",
                    "fingerprintText",
                    "conditionText",
                    "freshnessText",
                    "triageText",
                    "occurrenceNumber",
                    "occurrenceStartedAt",
                    "firstDetectedAt",
                    "lastDetectedAt",
                    "clearedAt",
                    "titleText",
                    "summaryText",
                    "subjectPersonUserId",
                    "priorityScore",
                    "priorityBandText",
                    "priorityFactorsJson",
                    "safetyFloorBandText",
                    "evaluationHashText",
                    "lastEvaluatedAt",
                    "evidenceRefsJson",
                    "triagedAt",
                    "triagedByUserId",
                    "triagedByAgentText",
                    "triageReasonText",
                    "snoozedUntil",
                    "triageEvaluationHashText",
                    "triagePriorityBandText",
                    "revision",
                    "effectiveTriageText",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "ruleKeyText": {
                      "type": "string",
                      "maxLength": 120
                    },
                    "ruleVersion": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "fingerprintText": {
                      "type": "string"
                    },
                    "conditionText": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "CLEARED"
                      ]
                    },
                    "freshnessText": {
                      "type": "string",
                      "enum": [
                        "FRESH",
                        "STALE",
                        "INCOMPLETE"
                      ]
                    },
                    "triageText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED",
                        "SNOOZED",
                        "DISMISSED"
                      ]
                    },
                    "occurrenceNumber": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "occurrenceStartedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "firstDetectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "lastDetectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "clearedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "summaryText": {
                      "type": "string"
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "priorityScore": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "priorityBandText": {
                      "type": "string",
                      "enum": [
                        "P0",
                        "P1",
                        "P2",
                        "P3"
                      ]
                    },
                    "priorityFactorsJson": {
                      "$ref": "#/components/schemas/JobOpsSignalPriorityBreakdown"
                    },
                    "safetyFloorBandText": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "P0",
                            "P1",
                            "P2",
                            "P3"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "evaluationHashText": {
                      "type": "string"
                    },
                    "lastEvaluatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "evidenceRefsJson": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "triagedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "triagedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triagedByAgentText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triageReasonText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "snoozedUntil": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "triageEvaluationHashText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triagePriorityBandText": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "P0",
                            "P1",
                            "P2",
                            "P3"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current signal revision — send back as expectedSignalRevision."
                    },
                    "effectiveTriageText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED",
                        "SNOOZED",
                        "DISMISSED"
                      ],
                      "description": "Derived read-time triage: an expired snooze reads as OPEN without a write."
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/signals/{signalId}/snooze": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "snoozeJobOperationsSignal",
        "summary": "Snooze an active signal",
        "description": "Snoozes an ACTIVE signal until an explicit expiry between 60 seconds and 2592000 seconds from now (out-of-range expiries are rejected, not clamped). A snooze expires automatically and breaks early on a worse priority band. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "signalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedSignalRevision",
                  "snoozeUntil"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedSignalRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current signal revision — the per-signal optimistic concurrency fence."
                  },
                  "snoozeUntil": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Triaged signal (presented row plus replayed flag)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The exact presented signal row plus the idempotency replay marker.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "ruleKeyText",
                    "ruleVersion",
                    "fingerprintText",
                    "conditionText",
                    "freshnessText",
                    "triageText",
                    "occurrenceNumber",
                    "occurrenceStartedAt",
                    "firstDetectedAt",
                    "lastDetectedAt",
                    "clearedAt",
                    "titleText",
                    "summaryText",
                    "subjectPersonUserId",
                    "priorityScore",
                    "priorityBandText",
                    "priorityFactorsJson",
                    "safetyFloorBandText",
                    "evaluationHashText",
                    "lastEvaluatedAt",
                    "evidenceRefsJson",
                    "triagedAt",
                    "triagedByUserId",
                    "triagedByAgentText",
                    "triageReasonText",
                    "snoozedUntil",
                    "triageEvaluationHashText",
                    "triagePriorityBandText",
                    "revision",
                    "effectiveTriageText",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "ruleKeyText": {
                      "type": "string",
                      "maxLength": 120
                    },
                    "ruleVersion": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "fingerprintText": {
                      "type": "string"
                    },
                    "conditionText": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "CLEARED"
                      ]
                    },
                    "freshnessText": {
                      "type": "string",
                      "enum": [
                        "FRESH",
                        "STALE",
                        "INCOMPLETE"
                      ]
                    },
                    "triageText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED",
                        "SNOOZED",
                        "DISMISSED"
                      ]
                    },
                    "occurrenceNumber": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "occurrenceStartedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "firstDetectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "lastDetectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "clearedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "summaryText": {
                      "type": "string"
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "priorityScore": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "priorityBandText": {
                      "type": "string",
                      "enum": [
                        "P0",
                        "P1",
                        "P2",
                        "P3"
                      ]
                    },
                    "priorityFactorsJson": {
                      "$ref": "#/components/schemas/JobOpsSignalPriorityBreakdown"
                    },
                    "safetyFloorBandText": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "P0",
                            "P1",
                            "P2",
                            "P3"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "evaluationHashText": {
                      "type": "string"
                    },
                    "lastEvaluatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "evidenceRefsJson": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "triagedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "triagedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triagedByAgentText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triageReasonText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "snoozedUntil": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "triageEvaluationHashText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triagePriorityBandText": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "P0",
                            "P1",
                            "P2",
                            "P3"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current signal revision — send back as expectedSignalRevision."
                    },
                    "effectiveTriageText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED",
                        "SNOOZED",
                        "DISMISSED"
                      ],
                      "description": "Derived read-time triage: an expired snooze reads as OPEN without a write."
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/signals/{signalId}/dismiss": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "dismissJobOperationsSignal",
        "summary": "Dismiss an active signal with a reason",
        "description": "Dismisses exactly the CURRENT evaluation/occurrence with a mandatory audit reason. Materially new evidence or a worse safety band reopens the signal automatically. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "signalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedSignalRevision",
                  "reason"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedSignalRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current signal revision — the per-signal optimistic concurrency fence."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Triaged signal (presented row plus replayed flag)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The exact presented signal row plus the idempotency replay marker.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "ruleKeyText",
                    "ruleVersion",
                    "fingerprintText",
                    "conditionText",
                    "freshnessText",
                    "triageText",
                    "occurrenceNumber",
                    "occurrenceStartedAt",
                    "firstDetectedAt",
                    "lastDetectedAt",
                    "clearedAt",
                    "titleText",
                    "summaryText",
                    "subjectPersonUserId",
                    "priorityScore",
                    "priorityBandText",
                    "priorityFactorsJson",
                    "safetyFloorBandText",
                    "evaluationHashText",
                    "lastEvaluatedAt",
                    "evidenceRefsJson",
                    "triagedAt",
                    "triagedByUserId",
                    "triagedByAgentText",
                    "triageReasonText",
                    "snoozedUntil",
                    "triageEvaluationHashText",
                    "triagePriorityBandText",
                    "revision",
                    "effectiveTriageText",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "ruleKeyText": {
                      "type": "string",
                      "maxLength": 120
                    },
                    "ruleVersion": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "fingerprintText": {
                      "type": "string"
                    },
                    "conditionText": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "CLEARED"
                      ]
                    },
                    "freshnessText": {
                      "type": "string",
                      "enum": [
                        "FRESH",
                        "STALE",
                        "INCOMPLETE"
                      ]
                    },
                    "triageText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED",
                        "SNOOZED",
                        "DISMISSED"
                      ]
                    },
                    "occurrenceNumber": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "occurrenceStartedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "firstDetectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "lastDetectedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "clearedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "summaryText": {
                      "type": "string"
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "priorityScore": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "priorityBandText": {
                      "type": "string",
                      "enum": [
                        "P0",
                        "P1",
                        "P2",
                        "P3"
                      ]
                    },
                    "priorityFactorsJson": {
                      "$ref": "#/components/schemas/JobOpsSignalPriorityBreakdown"
                    },
                    "safetyFloorBandText": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "P0",
                            "P1",
                            "P2",
                            "P3"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "evaluationHashText": {
                      "type": "string"
                    },
                    "lastEvaluatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "evidenceRefsJson": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "triagedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "triagedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triagedByAgentText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triageReasonText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "snoozedUntil": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "triageEvaluationHashText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "triagePriorityBandText": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "P0",
                            "P1",
                            "P2",
                            "P3"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current signal revision — send back as expectedSignalRevision."
                    },
                    "effectiveTriageText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED",
                        "SNOOZED",
                        "DISMISSED"
                      ],
                      "description": "Derived read-time triage: an expired snooze reads as OPEN without a write."
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/signals/{signalId}/claim": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "claimJobOperationsSignal",
        "summary": "Atomically claim work on a signal",
        "description": "The ONLY path that turns a signal into owned work: under the shared context lock it reuses the latest OPEN linked action, re-claims an expired lease, rejects a live lease, or creates attempt max+1 after a terminal attempt — then claims it with the existing lease and signed-receipt discipline. Claim eligibility matches the actionable queue exactly — condition ACTIVE, freshness FRESH, effective triage OPEN or ACKNOWLEDGED, non-shadow: cleared, dismissed, live-snoozed, STALE, and INCOMPLETE signals are rejected until the evaluator confirms the condition persists. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "signalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedSignalRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "expectedSignalRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current signal revision — the per-signal optimistic concurrency fence."
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  },
                  "leaseSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 14400,
                    "default": 900,
                    "description": "Out-of-range leases are rejected, not clamped."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Claimed signal action with its signed receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Atomic signal→action claim result: the claimed (created or reused) action attempt with its signed claim receipt. The signal row itself is untouched — ownership is derived from this action.",
                  "required": [
                    "action",
                    "claimReceipt",
                    "attemptNumber",
                    "created",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "action": {
                      "$ref": "#/components/schemas/JobOpsAction"
                    },
                    "claimReceipt": {
                      "type": "string",
                      "description": "Signed receipt required by action release/complete for this claim."
                    },
                    "attemptNumber": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "created": {
                      "type": "boolean",
                      "description": "True when this claim created a NEW action attempt (max + 1)."
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/policies": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsEffectivePolicies",
        "summary": "Effective typed policies",
        "description": "The active head of every typed-policy key lineage with validated payloads, projections, and attribution. Fail closed: when history exceeds the bounded authoritative read, complete=false and effective is intentionally empty — page the policy history instead. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Effective typed-policy state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The effective typed policies (active head per key). Fail closed: when history exceeds the bounded authoritative read, complete=false and effective is intentionally empty — page the policy history instead.",
                  "required": [
                    "contextRevision",
                    "complete",
                    "effective",
                    "storedInvalid",
                    "legacyUntypedPolicyCount",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer"
                    },
                    "complete": {
                      "type": "boolean"
                    },
                    "effective": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEffectiveTypedPolicy"
                      }
                    },
                    "storedInvalid": {
                      "type": "array",
                      "description": "Typed rows whose stored payload no longer parses — readable history, never enforced.",
                      "items": {
                        "type": "object",
                        "required": [
                          "decisionId",
                          "key"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "decisionId": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "legacyUntypedPolicyCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "recordJobOperationsPolicy",
        "summary": "Record or supersede a typed policy",
        "description": "Records one typed policy revision under the versioned registry contract. An update MUST name the exact current lineage head in supersedesDecisionId (database linear-supersession is the final fence); the first revision must omit it. WORKFLOW/CANONICAL_DB targets apply their brief/canonical enforcement atomically in the same transaction; EXTERNAL targets start PENDING_ENFORCEMENT and stay driftable until verified. Attribution (actor, agent label, approver) is recorded on the row. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "policyKey",
                  "payload",
                  "title"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "policyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "payload": {
                    "$ref": "#/components/schemas/JobOpsTypedPolicyPayload"
                  },
                  "enforcementTarget": {
                    "type": "string",
                    "enum": [
                      "GUIDE",
                      "WORKFLOW",
                      "CANONICAL_DB",
                      "EXTERNAL"
                    ],
                    "description": "Defaults to the policy family’s registry default target."
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "body": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "effectiveAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "expiresAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "GUIDE-target policies only — enforced targets reject expiry because enforcement cannot roll back automatically."
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  },
                  "supersedesDecisionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "Exact current lineage head. Required for an update; forbidden for the first revision."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded (or replayed) typed policy with enforcement receipts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Typed policy record result. WORKFLOW/CANONICAL_DB targets applied their brief/canonical enforcement atomically in the same transaction.",
                  "required": [
                    "decision",
                    "replayed",
                    "briefRevision",
                    "canonical",
                    "contextRevision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "decision": {
                      "$ref": "#/components/schemas/JobOpsTypedPolicyRow"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "briefRevision": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "New brief revision when WORKFLOW enforcement changed the workflow."
                    },
                    "canonical": {
                      "oneOf": [
                        {
                          "type": "object",
                          "description": "Atomic canonical-database application receipt (CANONICAL_DB target).",
                          "required": [
                            "itemsSeen",
                            "itemVersionsPublished",
                            "bindingsSeen",
                            "bindingPolicyOverrides",
                            "lessonModeOverrides",
                            "submittedLessonsCompleted",
                            "assignmentsReconciled",
                            "overrideEvidenceRefs"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "itemsSeen": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "itemVersionsPublished": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "bindingsSeen": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "bindingPolicyOverrides": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "lessonModeOverrides": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "submittedLessonsCompleted": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "assignmentsReconciled": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "overrideEvidenceRefs": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/JobOpsEvidenceRef"
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "contextRevision": {
                      "type": "integer"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/policies/history": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsPolicyHistory",
        "summary": "Paginated typed-policy lineage",
        "description": "The full append-only typed-policy history (superseded and expired revisions included), oldest revision first per key. Resume from nextCursor; each page reports the contextRevision it was fenced against. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "policyKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded policy history page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "One bounded page of the append-only typed-policy lineage, oldest revision first per key. Superseded and expired history included.",
                  "required": [
                    "contextRevision",
                    "complete",
                    "revisions",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer"
                    },
                    "complete": {
                      "type": "boolean",
                      "description": "True only when this single page contains the entire lineage."
                    },
                    "revisions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsTypedPolicyRow"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/policies/verify-enforcement": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "verifyJobOperationsPolicyEnforcement",
        "summary": "Verify external policy enforcement",
        "description": "Proves an EXTERNAL policy was applied outside OpenTrain. Decision rows are append-only, so the status transition is a SUPERSEDING revision (same key, same payload, revision+1, status APPLIED) carrying the mandatory verification evidence. Until this lands, the pending-enforcement drift signal stays active. This never calls or mutates an external provider. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "policyKey",
                  "evidenceRefs"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Exact current context revision precondition. A stale value is a recoverable 409 whose details carry reason=STALE_REVISION and currentRevision."
                  },
                  "policyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Verified proof of application — required, ids only.",
                    "minItems": 1
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Superseding APPLIED revision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "External enforcement verification result: a SUPERSEDING revision of the same policy carrying the verification evidence with status APPLIED.",
                  "required": [
                    "decision",
                    "replayed",
                    "contextRevision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "decision": {
                      "$ref": "#/components/schemas/JobOpsTypedPolicyRow"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "contextRevision": {
                      "type": "integer"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/guide": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsOperatingGuide",
        "summary": "Agent Guide canonical projection (typed, without the Playbook)",
        "description": "The deterministic, read-only canonical typed projection of the Agent Guide as structured JSON plus its Markdown rendering — a pure projection of the brief workflow, effective typed policies, prohibitions, exceptions, open claims, and top fresh attention signals. Kept for published clients; new work reads the composite Agent Guide (…/agent-guide). guideVersion pins the context revision; the checksum digests the canonical structured input excluding generatedAt. No table or editable Markdown is ever the authority, and discovery of this guide never authorizes automatic mutation. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Structured guide plus deterministic Markdown",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The canonical typed projection of the Agent Guide as structured JSON plus its deterministic Markdown rendering. Both are pure projections of the same fenced read.",
                  "required": [
                    "guide",
                    "markdown",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "guide": {
                      "$ref": "#/components/schemas/JobOpsOperatingGuide"
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/setup": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsSetup",
        "summary": "Deterministic shared guided-setup state",
        "description": "The machine-readable guided-setup packet for one job: which operational setup is still missing (operating brief/objective, typed workflow, applicable required operating choices), with canonical evidence, ordered questions, evidence-backed proposed defaults, validated canonical write previews, approval requirements, and the bounded in-progress dedupe view. Setup completion is shared across the employer team; explicit authorized deferral is an ordinary OPERATING_RULE typed policy at the closed per-component setup-deferral key. Read-only — the previewed writes go through the normal brief/policy operations. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The guided-setup packet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The machine-readable guided-setup packet: deterministic shared setup state, ordered questions with evidence-backed proposed defaults, validated canonical write previews, authority/approval requirements, whether work may continue, and the bounded in-progress dedupe view (active setup.* intents and open setup.* proposals).",
                  "required": [
                    "schemaVersion",
                    "jobId",
                    "contextExists",
                    "contextRevision",
                    "setup",
                    "questions",
                    "proposedWrites",
                    "approval",
                    "workMayContinue",
                    "evidenceRecovery",
                    "inProgress",
                    "workCatalog",
                    "sharedCompletion",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "enum": [
                        1
                      ]
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "contextExists": {
                      "type": "boolean"
                    },
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "setup": {
                      "$ref": "#/components/schemas/JobOpsSetupProjection"
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsSetupQuestion"
                      }
                    },
                    "proposedWrites": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsSetupProposedWrite"
                      }
                    },
                    "approval": {
                      "type": "object",
                      "required": [
                        "executionGuard",
                        "humanApprovalRequired",
                        "deferralPolicyKeys",
                        "statement"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "executionGuard": {
                          "type": "string",
                          "enum": [
                            "EXPLICIT_APPROVAL"
                          ]
                        },
                        "humanApprovalRequired": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "deferralPolicyKeys": {
                          "type": "object",
                          "required": [
                            "OBJECTIVE_BRIEF",
                            "TYPED_WORKFLOW",
                            "TRAINING_PRODUCTION_GATE"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "OBJECTIVE_BRIEF": {
                              "type": "string"
                            },
                            "TYPED_WORKFLOW": {
                              "type": "string"
                            },
                            "TRAINING_PRODUCTION_GATE": {
                              "type": "string"
                            }
                          }
                        },
                        "statement": {
                          "type": "string"
                        }
                      }
                    },
                    "workMayContinue": {
                      "type": "object",
                      "required": [
                        "allowed",
                        "reason"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "allowed": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": "string"
                        }
                      }
                    },
                    "evidenceRecovery": {
                      "description": "Non-null exactly when setup.status is INDETERMINATE: the safe read/retry path out of the fail-closed evidence state. Names a READ operation only — the platform never invents missing decisions.",
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "operationId",
                            "reason"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "operationId": {
                              "type": "string",
                              "enum": [
                                "job_operations.policies.list"
                              ]
                            },
                            "reason": {
                              "type": "string"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "inProgress": {
                      "type": "object",
                      "required": [
                        "intents",
                        "proposals",
                        "complete"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "intents": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "intentId",
                              "intentKey",
                              "title",
                              "principalUserId",
                              "agentLabel",
                              "sessionId",
                              "expiresAt"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "intentId": {
                                "type": "string"
                              },
                              "intentKey": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "principalUserId": {
                                "type": "string"
                              },
                              "agentLabel": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "sessionId": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "The durable sync session that declared this intent (null for legacy/ephemeral declarations). Adopting an intent requires the caller's current durable session to equal this value exactly."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        },
                        "proposals": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "proposalId",
                              "dedupeKey",
                              "title",
                              "proposedByUserId",
                              "createdAt"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "proposalId": {
                                "type": "string"
                              },
                              "dedupeKey": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "proposedByUserId": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        },
                        "complete": {
                          "type": "boolean"
                        }
                      }
                    },
                    "workCatalog": {
                      "$ref": "#/components/schemas/JobOpsWorkCatalogSummary"
                    },
                    "sharedCompletion": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/sync/poll": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "pollJobOperationsSync",
        "summary": "Bounded long-poll for a fresh sync envelope",
        "description": "With a fully verified prior `X-OpenTrain-Sync-Token` the request waits (bounded by waitSeconds ≤ 25) until the shared context head passes that token’s ceiling; without a usable token it returns immediately and the attached envelope carries the bootstrap packet. Presenting the prior token also acknowledges it (two-phase): generating a response never advances the durable cursor. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "waitSeconds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 25,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Wake signal; the attached sync envelope is authoritative",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Long-poll wake signal. The attached `sync` envelope is the authoritative payload; this body only says whether (and how long) the poll waited.",
                  "required": [
                    "contextRevision",
                    "changed",
                    "waitedMs",
                    "baselineRevision",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "changed": {
                      "type": "boolean"
                    },
                    "waitedMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "baselineRevision": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/intents": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsIntents",
        "summary": "List write-ahead intents",
        "description": "Bounded keyset-paged intents with lazy effective expiry (reported, never written from a read). Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "PROMOTED",
                "COMPLETED",
                "ABANDONED",
                "EXPIRED",
                "REJECTED"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded intent page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "intents",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "intents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsIntentPublicView"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "declareJobOperationsIntent",
        "summary": "Declare a write-ahead work intent",
        "description": "Declares spontaneous work before any canonical action exists. Exactly one of three outcomes: DECLARED (this caller owns the fresh head), REPLAYED (same key + identical payload), or DUPLICATE — a typed loser packet with the live winner’s attribution instead of an opaque unique-index error. Session identity is resolved ONLY from the server-minted credential header; request fields can never name a session. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "kind",
                  "intentKey",
                  "title"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "MESSAGE_SEND",
                      "POLICY_RECORD",
                      "WORKFLOW_CHANGE",
                      "ACTION_WORK",
                      "CAPABILITY_EXECUTION",
                      "OTHER"
                    ]
                  },
                  "intentKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Deterministic dedupe key, normalized [a-z0-9._:-]{1,200}."
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "body": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 5000
                  },
                  "target": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Closed typed pointers only; unknown fields rejected.",
                    "properties": {
                      "personUserId": {
                        "type": "string"
                      },
                      "actionId": {
                        "type": "string"
                      },
                      "signalId": {
                        "type": "string"
                      },
                      "conversationId": {
                        "type": "string"
                      },
                      "refs": {
                        "type": "array",
                        "maxItems": 50,
                        "items": {
                          "$ref": "#/components/schemas/JobOpsEvidenceRef"
                        },
                        "description": "Privacy-safe pointers at canonical records — identity, never content."
                      }
                    }
                  },
                  "capabilityOperationId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Manifest operation id — required exactly for kind CAPABILITY_EXECUTION."
                  },
                  "leaseSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 14400,
                    "default": 900
                  },
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Optional optimistic pin — most declarations are spontaneous."
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Declared, replayed, or typed-duplicate outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Declared/replayed intent, or the typed DUPLICATE loser packet naming the live winner's attribution.",
                  "required": [
                    "outcome",
                    "contextRevision",
                    "conflict",
                    "intent",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "DECLARED",
                        "REPLAYED",
                        "DUPLICATE"
                      ]
                    },
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "conflict": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncConflict"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "intent": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsIntentPublicView"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/intents/{intentId}/resolve": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "resolveJobOperationsIntent",
        "summary": "Resolve a write-ahead intent",
        "description": "Terminalizes an ACTIVE intent (COMPLETED / ABANDONED / REJECTED / PROMOTED — promotion links the produced canonical action). The declaring principal resolves their own intent; REJECTING another principal’s intent requires employer authority. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "intentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "resolution",
                  "expectedIntentRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "resolution": {
                    "type": "string",
                    "enum": [
                      "COMPLETED",
                      "ABANDONED",
                      "REJECTED",
                      "PROMOTED"
                    ]
                  },
                  "promotedActionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Required exactly for resolution PROMOTED."
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "expectedIntentRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resolved (or replayed) intent",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "replayed",
                    "intent",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "intent": {
                      "$ref": "#/components/schemas/JobOpsIntentPublicView"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/proposals": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsProposals",
        "summary": "List agent proposals",
        "description": "Deterministically ranked (priority band, score desc, createdAt, id), bounded, read-only listing with lazy effective expiry. Proposals are NON-ENFORCED: no policy resolver ever reads them. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "ACCEPTED",
                "DECLINED",
                "WITHDRAWN",
                "EXPIRED",
                "SUPERSEDED"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "POLICY",
                "WORKFLOW",
                "PRIORITY",
                "GOAL",
                "EXCEPTION",
                "CAPABILITY_EXECUTION"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded ranked proposal page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "proposals",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "proposals": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsProposalPublicView"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "submitJobOperationsProposal",
        "summary": "Submit a non-enforced agent proposal",
        "description": "Submits a proposal for human review. Dedupe is a feature: a live OPEN proposal under the same key returns DEDUPLICATED with the existing head. The execution guard and priority are computed server-side under closed monotonic floors; proposals never execute anything and are never read by policy resolvers. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "kind",
                  "dedupeKey",
                  "title"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "POLICY",
                      "WORKFLOW",
                      "PRIORITY",
                      "GOAL",
                      "EXCEPTION",
                      "CAPABILITY_EXECUTION"
                    ]
                  },
                  "dedupeKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "body": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 5000
                  },
                  "payload": {
                    "type": "object",
                    "description": "Typed per-kind payload (strict closed parser at write time)."
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "capabilityOperationId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Manifest operation id — required exactly for kind CAPABILITY_EXECUTION."
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 2592000
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Submitted, replayed, or deduplicated proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Submitted/replayed proposal, or DEDUPLICATED with the existing live OPEN head under the same dedupe key.",
                  "required": [
                    "outcome",
                    "contextRevision",
                    "proposal",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "SUBMITTED",
                        "REPLAYED",
                        "DEDUPLICATED"
                      ]
                    },
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "proposal": {
                      "$ref": "#/components/schemas/JobOpsProposalPublicView"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/proposals/{proposalId}/review": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "reviewJobOperationsProposal",
        "summary": "Review a proposal (accept or decline)",
        "description": "ACCEPT links the canonical artifact created through the normal authorized operations (decision for POLICY/EXCEPTION; brief revision or decision for WORKFLOW/GOAL; action for PRIORITY/CAPABILITY_EXECUTION) — review NEVER executes anything, and accepting a shared-authority kind requires employer OWNER authority. DECLINE terminalizes with attribution. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "decision",
                  "expectedProposalRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "ACCEPT",
                      "DECLINE"
                    ]
                  },
                  "resultingDecisionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "resultingActionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "resultingBriefRevision": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "expectedProposalRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reviewed (or replayed) proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "replayed",
                    "proposal",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "proposal": {
                      "$ref": "#/components/schemas/JobOpsProposalPublicView"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/proposals/{proposalId}/withdraw": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "withdrawJobOperationsProposal",
        "summary": "Withdraw an open proposal",
        "description": "Submitter-only: terminalizes the caller’s own OPEN proposal with attribution. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedProposalRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "expectedProposalRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Withdrawn (or replayed) proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "replayed",
                    "proposal",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "proposal": {
                      "$ref": "#/components/schemas/JobOpsProposalPublicView"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/agent-guide": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsAgentGuide",
        "summary": "Agent Guide (canonical projection + published Playbook)",
        "description": "The ONE guidance document for a job: the deterministic canonical projection of typed authority PLUS the human-published Playbook (bounded Markdown sections with stable sectionIds and per-section content hashes, version, publisher attribution) and the open Playbook-proposal count, under one context revision and one checksum. Bootstrap sync.nextOperations ends with job_operations.agent_guide.get — read it once per session, then rely on the envelope’s recommendation.agent_guide_changed for exact section deltas. Playbook prose can never waive a gate, change readiness, or override a typed record. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The composite Agent Guide as JSON plus Markdown",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The Agent Guide as structured JSON plus one deterministic Markdown rendering (canonical projection first, then the Playbook demoted under an explicit precedence notice).",
                  "required": [
                    "guide",
                    "markdown",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "guide": {
                      "$ref": "#/components/schemas/JobOpsAgentGuide"
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/playbook": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsPlaybook",
        "summary": "Published Playbook head",
        "description": "The current published Playbook version (canonical Markdown sections with stable ids and content hashes, publisher attribution, delta versus the superseded version) plus its Markdown rendering, or the explicit empty state when nothing is published. Never editor JSON. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The published head under a context-revision fence",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The current published Playbook head under a context-revision fence (published=null and the explicit empty-state Markdown when nothing is published yet).",
                  "required": [
                    "schemaVersion",
                    "jobId",
                    "contextRevision",
                    "published",
                    "markdown",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "schemaVersion": {
                      "type": "integer",
                      "enum": [
                        1
                      ]
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "published": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsPlaybookVersion"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/playbook/versions": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsPlaybookVersions",
        "summary": "List published Playbook versions",
        "description": "Newest-first bounded version history (summaries without sections) under a coherent revision fence. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded version summaries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Newest-first bounded history; hasMore=true means older versions exist beyond the limit.",
                  "required": [
                    "contextRevision",
                    "versions",
                    "hasMore",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "versions": {
                      "type": "array",
                      "maxItems": 200,
                      "items": {
                        "$ref": "#/components/schemas/JobOpsPlaybookVersionSummary"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/playbook/versions/{playbookVersion}": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsPlaybookVersion",
        "summary": "Read one published Playbook version",
        "description": "One immutable published version with its full sections and Markdown; unknown versions read as 404. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "playbookVersion",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "A published Playbook version number (1-based, linear)."
          }
        ],
        "responses": {
          "200": {
            "description": "The exact published version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "version",
                    "markdown",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "version": {
                      "$ref": "#/components/schemas/JobOpsPlaybookVersion"
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/playbook/delta": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsPlaybookDelta",
        "summary": "Playbook section delta between two versions",
        "description": "The exact section delta from fromVersion (0 = nothing held) to toVersion (default: the current head): added and changed sections in full, removedSectionIds tombstones, unchangedSectionIds, and the full sectionOrder at toVersion — so an agent refreshes only what changed. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "fromVersion",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "The version you currently hold (0 when none)."
          },
          {
            "name": "toVersion",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Target version; defaults to the current head."
          }
        ],
        "responses": {
          "200": {
            "description": "Exact section delta",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "delta is null only when no shared context exists yet and fromVersion is 0 (nothing to diff).",
                  "required": [
                    "contextRevision",
                    "delta",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "delta": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsPlaybookDelta"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/playbook/publish": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "publishJobOperationsPlaybook",
        "summary": "Publish a Playbook version (human job-manager court)",
        "description": "Publishes a new Playbook version from the closed editor-subset document (headings with stable ids, paragraphs, lists, code, quotes). HUMAN job-manager court only: agent principals are refused; an agent acting under a human token is attributed by agentLabel. expectedPlaybookVersion is the CAS pin against the current head (0 when nothing is published); expectedContextRevision is an optional additional pin; unchanged content is refused; acceptProposalIds link only proposals whose exact section content-hash landed. The response is the closed public version — the document is never echoed. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedPlaybookVersion",
                  "document"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedPlaybookVersion": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The CURRENT published head version (0 when none) — the CAS pin."
                  },
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Optional additional context-revision pin."
                  },
                  "document": {
                    "type": "object",
                    "description": "The closed editor-subset document (schemaVersion 1): {\"type\":\"doc\",\"content\":[…]} whose heading nodes carry stable attrs.id."
                  },
                  "publicationNote": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "acceptProposalIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "description": "OPEN proposal ids this publication lands (exact content-hash acceptance)."
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The published (or exactly replayed) version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The published (or exactly replayed) version as the closed public projection — the submitted editor document is never echoed.",
                  "required": [
                    "contextRevision",
                    "replayed",
                    "version",
                    "markdown",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "version": {
                      "$ref": "#/components/schemas/JobOpsPlaybookVersion"
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/playbook/proposals": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsPlaybookProposals",
        "summary": "List Playbook proposals",
        "description": "Oldest-first bounded listing of attributable Playbook proposals and notes with lazy effective expiry and staleness against the current head. Proposals are NON-ENFORCED: no projector or policy resolver ever reads them. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "ACCEPTED",
                "DECLINED",
                "WITHDRAWN",
                "EXPIRED",
                "SUPERSEDED"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SECTION_UPSERT",
                "SECTION_REMOVE",
                "NOTE"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded proposal page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Oldest-first bounded proposal page with lazy effective expiry; headPlaybookVersion is the head every entry’s staleAgainstHead was judged against.",
                  "required": [
                    "contextRevision",
                    "headPlaybookVersion",
                    "proposals",
                    "hasMore",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "headPlaybookVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "proposals": {
                      "type": "array",
                      "maxItems": 200,
                      "items": {
                        "$ref": "#/components/schemas/JobOpsPlaybookProposal"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "submitJobOperationsPlaybookProposal",
        "summary": "Submit a Playbook proposal or note",
        "description": "The agent path for guidance: an attributable SECTION_UPSERT (proposed section — the server hashes the full canonical section), SECTION_REMOVE (naming a sectionId), or NOTE with RECOMMENDED authority — never enforced. basePlaybookVersion must equal the CURRENT head (0 when none): stale bases fail closed. Dedupe is a feature: a live OPEN proposal under the same key returns DEDUPLICATED. Only a human job manager publishes. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "kind",
                  "dedupeKey",
                  "basePlaybookVersion",
                  "title"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "SECTION_UPSERT",
                      "SECTION_REMOVE",
                      "NOTE"
                    ]
                  },
                  "dedupeKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "basePlaybookVersion": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The CURRENT published head version the proposal was written against."
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "body": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "sectionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Required for SECTION_UPSERT / SECTION_REMOVE; optional anchor for NOTE."
                  },
                  "proposedSection": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "level",
                          "heading",
                          "markdown"
                        ],
                        "properties": {
                          "level": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 6
                          },
                          "heading": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "markdown": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 12000
                          }
                        }
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "SECTION_UPSERT only: plain Markdown body without heading lines or HTML."
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 3600,
                    "maximum": 7776000
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Submitted, replayed, or deduplicated proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Submitted/replayed proposal, or DEDUPLICATED with the existing live OPEN head under the same dedupe key.",
                  "required": [
                    "outcome",
                    "contextRevision",
                    "proposal",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "SUBMITTED",
                        "REPLAYED",
                        "DEDUPLICATED"
                      ]
                    },
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "proposal": {
                      "$ref": "#/components/schemas/JobOpsPlaybookProposal"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/playbook/proposals/{proposalId}/resolve": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "resolveJobOperationsPlaybookProposal",
        "summary": "Resolve a Playbook proposal (accept, decline, or withdraw)",
        "description": "ACCEPT is the human job-manager court and, for SECTION kinds, must name the published resultingPlaybookVersion whose section content-hash exactly matches; DECLINE is the assigned court; WITHDRAW is the proposer only. Every decision is fenced by expectedProposalRevision and never edits the Playbook. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "decision",
                  "expectedProposalRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "ACCEPT",
                      "DECLINE",
                      "WITHDRAW"
                    ]
                  },
                  "expectedProposalRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Per-proposal optimistic-concurrency fence."
                  },
                  "resultingPlaybookVersion": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "description": "ACCEPT of a SECTION kind: the published version that landed it."
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The resolved (or exactly replayed) proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "replayed",
                    "proposal",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "proposal": {
                      "$ref": "#/components/schemas/JobOpsPlaybookProposal"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/guide/overlays": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsOverlays",
        "summary": "Read the caller-visible guide overlay stack",
        "description": "The shared TEAM head plus the caller’s OWN personal head and credential-resolved session scratch. Overlay content is untrusted attributed data with typed-reference-only lint flags — never protocol instructions, never read by gates or readiness. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coherent overlay stack snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The caller-visible overlay stack: the shared TEAM head plus the caller's OWN personal head and credential-resolved session scratch, read in one coherent snapshot.",
                  "required": [
                    "contextRevision",
                    "policyEvidenceComplete",
                    "team",
                    "personal",
                    "session",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "policyEvidenceComplete": {
                      "type": "boolean"
                    },
                    "team": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsGuideOverlayScopeView"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "personal": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsGuideOverlayScopeView"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "session": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsGuideOverlayScopeView"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "setJobOperationsOverlay",
        "summary": "Record a guide overlay revision for one scope",
        "description": "Appends a full-replacement overlay revision ([] clears the layer) under an optimistic expectedOverlayRevision pin. Authority courts: TEAM requires employer-owner authority; PERSONAL requires the caller as scope principal; SESSION requires the caller’s own credential-resolved session. Entries carry no gate semantics — structurally incapable of touching gates or readiness. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "layer",
                  "entries",
                  "expectedOverlayRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "layer": {
                    "type": "string",
                    "enum": [
                      "TEAM",
                      "PERSONAL",
                      "SESSION"
                    ]
                  },
                  "entries": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "object",
                      "required": [
                        "kind",
                        "statement"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "REQUIREMENT",
                            "PROHIBITION",
                            "NOTE"
                          ]
                        },
                        "statement": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "rationale": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "relatedPolicyKey": {
                          "type": "string"
                        },
                        "relatedGateKey": {
                          "type": "string"
                        },
                        "relatedOperationId": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "expectedOverlayRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "agentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S",
                    "description": "Optional sync-session agent label (the public sync routes cap this at 120)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded (or replayed) overlay revision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "replayed",
                    "overlay",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "overlay": {
                      "type": "object",
                      "required": [
                        "overlayId",
                        "layer",
                        "scopeKey",
                        "overlayRevision",
                        "recordedAt"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "overlayId": {
                          "type": "string"
                        },
                        "layer": {
                          "type": "string",
                          "enum": [
                            "TEAM",
                            "PERSONAL",
                            "SESSION"
                          ]
                        },
                        "scopeKey": {
                          "type": "string"
                        },
                        "overlayRevision": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "recordedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsWorkDefinitions",
        "summary": "List this job’s Work Definitions",
        "description": "Keyset-paged per-job Work Definitions with CURRENT (active) and LATEST (lineage-head) version summaries including the full semantic binding trio every definition-bound mutation must present. Work semantics are per-job data — the platform ships coordination mechanics only. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded definition page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "definitions",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "definitions": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "$ref": "#/components/schemas/JobOpsWorkDefinitionSummary"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "createJobOperationsWorkDefinition",
        "summary": "Define a new kind of atomic work for THIS job",
        "description": "Creates a DRAFT definition head plus immutable version 1 from a bounded typed target grammar, identity role keys, scope templates, phases, and lease policy. Authority DECIDED requires human decision; INFERRED proposals can be stored but never activated without approval. Same key + identical payload replays; a reused key with a different payload conflicts. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "definitionKey",
                  "label",
                  "targetGrammar",
                  "identityRoleKeys",
                  "lease",
                  "authority",
                  "approvalDecisionId"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$",
                    "description": "Per-job identifier, normalized [a-z0-9][a-z0-9_-]*."
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300,
                    "pattern": "\\S"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "targetGrammar": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Canonical invariants (server-enforced, cross-field): role keys are unique and at least ONE role is required; identityRoleKeys and every ROLE exclusive scope name required grammar roles; every ROLE related scope names a grammar role.",
                    "items": {
                      "type": "object",
                      "required": [
                        "roleKey",
                        "kind",
                        "required"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "roleKey": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,59}$"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "contract",
                            "proposal",
                            "person",
                            "job",
                            "ops_action",
                            "ops_observation",
                            "ops_decision",
                            "ops_work_execution"
                          ],
                          "description": "CLOSED platform target kind (entity vocabulary, never a work type)."
                        },
                        "required": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "identityRoleKeys": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Unique role keys that compose the canonical identity — each MUST be a REQUIRED role of targetGrammar (server-enforced cross-field invariant).",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    }
                  },
                  "exclusiveScopes": {
                    "type": "array",
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Unique scope templates: a ROLE scope names a grammar role (an EXCLUSIVE ROLE scope must name a REQUIRED role — server-enforced cross-field invariant); a JOB scope carries no role key.",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope",
                            "roleKey"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "ROLE"
                              ]
                            },
                            "roleKey": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "JOB"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  },
                  "relatedScopes": {
                    "type": "array",
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Unique scope templates: a ROLE scope names a grammar role (an EXCLUSIVE ROLE scope must name a REQUIRED role — server-enforced cross-field invariant); a JOB scope carries no role key.",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope",
                            "roleKey"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "ROLE"
                              ]
                            },
                            "roleKey": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "JOB"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  },
                  "phases": {
                    "type": "array",
                    "maxItems": 20,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "lease": {
                    "type": "object",
                    "required": [
                      "ttlSeconds"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "ttlSeconds": {
                        "type": "integer",
                        "minimum": 60,
                        "maximum": 14400
                      },
                      "heartbeatSeconds": {
                        "type": "integer",
                        "minimum": 30,
                        "maximum": 14399,
                        "description": "Must be shorter than ttlSeconds (server-enforced cross-field rule)."
                      }
                    }
                  },
                  "authority": {
                    "type": "string",
                    "enum": [
                      "INFERRED",
                      "DECIDED"
                    ]
                  },
                  "approvalDecisionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "C-DEV3191-060: null for INFERRED; for DECIDED the human-approved WORK_DEFINITION_APPROVAL decision bound to these exact semantics (required non-null — the server refuses forged, mismatched, superseded, or agent-recorded approvals)."
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (or replayed) definition + immutable version 1",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "definition",
                    "version",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "definition": {
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "definitionKey",
                            "status",
                            "revision",
                            "createdAt",
                            "createdByUserId"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "definitionKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "DRAFT",
                                "ACTIVE",
                                "ARCHIVED"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "createdByUserId": {
                              "type": "string"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions/propose-from-provisional": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "proposeJobOperationsWorkDefinitionFromProvisional",
        "summary": "Propose a DRAFT definition from observed provisional work",
        "description": "Derives a DRAFT definition (authority INFERRED — activation requires human approval) from one live provisional execution’s validated targets. The provisional SOURCE identity converges: proposing again from the same source names the already-derived definition instead of minting a duplicate. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "provisionalExecutionId",
                  "definitionKey"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "provisionalExecutionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300,
                    "pattern": "\\S"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "lease": {
                    "type": "object",
                    "required": [
                      "ttlSeconds"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "ttlSeconds": {
                        "type": "integer",
                        "minimum": 60,
                        "maximum": 14400
                      },
                      "heartbeatSeconds": {
                        "type": "integer",
                        "minimum": 30,
                        "maximum": 14399,
                        "description": "Must be shorter than ttlSeconds (server-enforced cross-field rule)."
                      }
                    }
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "DRAFT proposal or typed same-source convergence",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "DRAFT proposal from provisional work — or the typed convergence outcome naming the definition the SAME provisional source already derived. RC10: `duplicateCandidates` names ATTRIBUTED possible duplicates of the proposal (bounded, completeness-honest); it never merges or declares equivalence.",
                  "required": [
                    "definition",
                    "version",
                    "convergedOn",
                    "duplicateCandidates",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "duplicateCandidates": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkDuplicateCandidatePacket"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "definition": {
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "definitionKey",
                            "status",
                            "revision",
                            "createdAt",
                            "createdByUserId"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "definitionKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "DRAFT",
                                "ACTIVE",
                                "ARCHIVED"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "createdByUserId": {
                              "type": "string"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "convergedOn": {
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "definitionKey",
                            "definitionStatus",
                            "reason"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "definitionKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                            },
                            "definitionStatus": {
                              "type": "string",
                              "enum": [
                                "DRAFT",
                                "ACTIVE",
                                "ARCHIVED"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "SAME_PROVISIONAL_SOURCE"
                              ]
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions/{definitionKey}": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "getJobOperationsWorkDefinition",
        "summary": "One Work Definition with full grammar + bounded version history",
        "description": "Full parsed coordination grammar for the CURRENT and LATEST versions plus a hard-bounded keyset-paged history slice (newest first) — everything needed to compose valid targets and present exact semantic bindings. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "definitionKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "versionsCursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "versionsLimit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Definition detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "definition",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "definition": {
                      "type": "object",
                      "required": [
                        "definitionKey",
                        "status",
                        "revision",
                        "migrationInProgress",
                        "createdAt",
                        "createdByUserId",
                        "createdByAgentLabel",
                        "currentVersion",
                        "latestVersion",
                        "versions",
                        "versionsHasMore",
                        "nextVersionsCursor",
                        "duplicateCandidates"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "definitionKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "ACTIVE",
                            "ARCHIVED"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "migrationInProgress": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "createdByUserId": {
                          "type": "string"
                        },
                        "createdByAgentLabel": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "currentVersion": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkVersionDetail"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "latestVersion": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkVersionDetail"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "versions": {
                          "type": "array",
                          "maxItems": 50,
                          "description": "Hard-bounded keyset-paged history slice, newest first.",
                          "items": {
                            "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
                          }
                        },
                        "versionsHasMore": {
                          "type": "boolean"
                        },
                        "nextVersionsCursor": {
                          "oneOf": [
                            {
                              "type": "integer",
                              "minimum": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "duplicateCandidates": {
                          "description": "RC10 (C-DEV3191-079): attributed possible duplicates of the LATEST version; null when the definition has no readable latest version.",
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkDuplicateCandidatePacket"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions/{definitionKey}/versions": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "appendJobOperationsWorkDefinitionVersion",
        "summary": "Append the next immutable definition version (linear lineage)",
        "description": "Appends exactly max+1, superseding the CURRENT latest version. Requires the FULL binding of the version being superseded (LATEST lineage head — re-verified in-transaction, C-DEV3191-044). Accepted appends replay even after the head is later archived; fresh appends on an archived head are refused. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "definitionKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "label",
                  "targetGrammar",
                  "identityRoleKeys",
                  "lease",
                  "authority",
                  "approvalDecisionId",
                  "supersedesVersionId",
                  "expectedDefinitionBinding"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300,
                    "pattern": "\\S"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  },
                  "targetGrammar": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Canonical invariants (server-enforced, cross-field): role keys are unique and at least ONE role is required; identityRoleKeys and every ROLE exclusive scope name required grammar roles; every ROLE related scope names a grammar role.",
                    "items": {
                      "type": "object",
                      "required": [
                        "roleKey",
                        "kind",
                        "required"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "roleKey": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,59}$"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "contract",
                            "proposal",
                            "person",
                            "job",
                            "ops_action",
                            "ops_observation",
                            "ops_decision",
                            "ops_work_execution"
                          ],
                          "description": "CLOSED platform target kind (entity vocabulary, never a work type)."
                        },
                        "required": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "identityRoleKeys": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Unique role keys that compose the canonical identity — each MUST be a REQUIRED role of targetGrammar (server-enforced cross-field invariant).",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    }
                  },
                  "exclusiveScopes": {
                    "type": "array",
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Unique scope templates: a ROLE scope names a grammar role (an EXCLUSIVE ROLE scope must name a REQUIRED role — server-enforced cross-field invariant); a JOB scope carries no role key.",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope",
                            "roleKey"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "ROLE"
                              ]
                            },
                            "roleKey": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "JOB"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  },
                  "relatedScopes": {
                    "type": "array",
                    "maxItems": 12,
                    "uniqueItems": true,
                    "description": "Unique scope templates: a ROLE scope names a grammar role (an EXCLUSIVE ROLE scope must name a REQUIRED role — server-enforced cross-field invariant); a JOB scope carries no role key.",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope",
                            "roleKey"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "ROLE"
                              ]
                            },
                            "roleKey": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "scope"
                          ],
                          "properties": {
                            "scope": {
                              "type": "string",
                              "enum": [
                                "JOB"
                              ]
                            }
                          }
                        }
                      ]
                    }
                  },
                  "phases": {
                    "type": "array",
                    "maxItems": 20,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "lease": {
                    "type": "object",
                    "required": [
                      "ttlSeconds"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "ttlSeconds": {
                        "type": "integer",
                        "minimum": 60,
                        "maximum": 14400
                      },
                      "heartbeatSeconds": {
                        "type": "integer",
                        "minimum": 30,
                        "maximum": 14399,
                        "description": "Must be shorter than ttlSeconds (server-enforced cross-field rule)."
                      }
                    }
                  },
                  "authority": {
                    "type": "string",
                    "enum": [
                      "INFERRED",
                      "DECIDED"
                    ]
                  },
                  "approvalDecisionId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "C-DEV3191-060: null for INFERRED; for DECIDED the human-approved WORK_DEFINITION_APPROVAL decision bound to these exact semantics (required non-null — the server refuses forged, mismatched, superseded, or agent-recorded approvals)."
                  },
                  "supersedesVersionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expectedDefinitionBinding": {
                    "type": "object",
                    "required": [
                      "versionNumber",
                      "contentHash",
                      "coordinationSignature"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "versionNumber": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "contentHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "coordinationSignature": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    }
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Appended (or replayed) immutable version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "version",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "version": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions/{definitionKey}/activate": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "activateJobOperationsWorkDefinition",
        "summary": "Activate the latest definition version (append-forward)",
        "description": "Makes the LATEST lineage version current. Requires that version’s FULL binding (re-verified in-transaction); INFERRED versions and unconfirmed broad exclusive scopes are refused; coordination-changing activations drain OPEN old-version executions first; ARCHIVED heads are terminal for fresh activation (accepted activations still replay). Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "definitionKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedDefinitionRevision",
                  "versionId",
                  "expectedDefinitionBinding"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "expectedDefinitionRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "versionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expectedDefinitionBinding": {
                    "type": "object",
                    "required": [
                      "versionNumber",
                      "contentHash",
                      "coordinationSignature"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "versionNumber": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "contentHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "coordinationSignature": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    }
                  },
                  "confirmBroadExclusiveScopes": {
                    "type": "boolean"
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Activated (or replayed) current version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "definitionKey",
                    "activatedVersionId",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "definitionKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                    },
                    "activatedVersionId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions/{definitionKey}/archive": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "archiveJobOperationsWorkDefinition",
        "summary": "Archive a definition (terminal)",
        "description": "Retires the definition. Requires the FULL binding of the LATEST lineage version (the semantics being retired); refused while OPEN executions remain or a migration is in progress. Terminal: fresh evolution mutations on an archived head are refused forever. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "definitionKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedDefinitionRevision",
                  "expectedDefinitionBinding"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "expectedDefinitionRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "expectedDefinitionBinding": {
                    "type": "object",
                    "required": [
                      "versionNumber",
                      "contentHash",
                      "coordinationSignature"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "versionNumber": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "contentHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "coordinationSignature": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    }
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Archived (or replayed)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "definitionKey",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "definitionKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions/{definitionKey}/migration/start": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "startJobOperationsWorkMigration",
        "summary": "Arm a separately approved bounded work migration",
        "description": "Arms the claim freeze for an approved WORK_MIGRATION typed decision, writing the FROZEN approved-meaning receipt continuation batches re-verify. Requires the FULL bindings of BOTH semantic snapshots: the historical SOURCE version and the CURRENT target. Exact replays and same-decision convergence survive the freeze; a different migration is refused. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "definitionKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedDefinitionRevision",
                  "migrationDecisionId",
                  "expectedSourceBinding",
                  "expectedTargetBinding"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "expectedDefinitionRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "migrationDecisionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expectedSourceBinding": {
                    "type": "object",
                    "required": [
                      "versionNumber",
                      "contentHash",
                      "coordinationSignature"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "versionNumber": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "contentHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "coordinationSignature": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    }
                  },
                  "expectedTargetBinding": {
                    "type": "object",
                    "required": [
                      "versionNumber",
                      "contentHash",
                      "coordinationSignature"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "versionNumber": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "contentHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "coordinationSignature": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    }
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Armed, converged, or replayed migration state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "definitionKey",
                    "frozen",
                    "converged",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "definitionKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                    },
                    "frozen": {
                      "type": "boolean"
                    },
                    "converged": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/definitions/{definitionKey}/migration/batch": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "runJobOperationsWorkMigrationBatch",
        "summary": "Run one bounded restart-safe migration batch",
        "description": "Re-pins one bounded page of OPEN, unclaimed, non-provisional executions from the frozen receipt’s source to its target version; claimed work completes under its pinned version. Continuation proves the receipt against the immutable version rows and the still-approved decision; the freeze clears when nothing remains. Every accepted batch writes a durable strict-closed outcome receipt that replays honestly — even after completion. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and no `expectedContextRevision` precondition — this continuation is fenced by the durable server-side receipt and its per-batch operation keys instead. Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "definitionKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "batchSize"
                ],
                "additionalProperties": false,
                "properties": {
                  "batchSize": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch outcome (or its honest replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "definitionKey",
                    "migratedCount",
                    "remainingCount",
                    "completed",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "definitionKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                    },
                    "migratedCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "remainingCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "completed": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/executions": {
      "get": {
        "tags": [
          "job-operations"
        ],
        "operationId": "listJobOperationsWorkExecutions",
        "summary": "List Work Executions with coordinating-action state",
        "description": "Keyset-paged executions. Every row names its pinned definition binding and its ONE coordinating action (the single claim authority) with the verified live claim + claim-handoff reservation projection. Requires `jobs:read`, a claimed token, and canonical per-job employer access (denials read as 404). Always on — no rollout flag.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "COMPLETED",
                "CANCELED",
                "SUPERSEDED"
              ]
            }
          },
          {
            "name": "definitionKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80,
              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
            }
          },
          {
            "name": "provisional",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded execution page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contextRevision",
                    "executions",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "contextRevision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "executions": {
                      "type": "array",
                      "maxItems": 200,
                      "items": {
                        "$ref": "#/components/schemas/JobOpsWorkExecutionRecord"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:read scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Coherent snapshot temporarily unavailable — the fenced read exhausted its bounded transaction budget (code CONTEXT_SNAPSHOT_TIMEOUT, retryable; details carry operation, phase, stage, attempt, elapsedMs, timeoutKind, and fallbackOperations)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "beginJobOperationsWorkExecution",
        "summary": "Begin one atomic unit of DEFINED work",
        "description": "Validates the presented role → target refs against the definition grammar, computes the canonical server key (identical meaning = identical key, any wording), fences one OPEN execution per key, binds exclusive scope locks, and creates the ONE coordinating action. Requires the FULL current-version binding, re-verified in-transaction. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "definitionKey",
                  "targets",
                  "expectedDefinitionBinding"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "targets": {
                    "type": "object",
                    "minProperties": 1,
                    "maxProperties": 12,
                    "propertyNames": {
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "required": [
                        "kind",
                        "entityId"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "contract",
                            "proposal",
                            "person",
                            "job",
                            "ops_action",
                            "ops_observation",
                            "ops_decision",
                            "ops_work_execution"
                          ]
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200,
                          "pattern": "^[^*?%]+$"
                        }
                      }
                    },
                    "description": "Role key → exactly ONE closed target ref; the server verifies existence/tenancy of every ref in-transaction."
                  },
                  "expectedDefinitionBinding": {
                    "type": "object",
                    "required": [
                      "versionNumber",
                      "contentHash",
                      "coordinationSignature"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "versionNumber": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "contentHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "coordinationSignature": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    }
                  },
                  "phase": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "subjectPersonUserId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "actionTitle": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Begun (or replayed) execution + coordinating action",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "execution",
                    "action",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "execution": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkExecutionMutationRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "action": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsAction"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/executions/provisional": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "beginProvisionalJobOperationsWorkExecution",
        "summary": "Begin PROVISIONAL (ad hoc) work with full coordination",
        "description": "Undefined work is still fully coordinated at creation: bounded label + typed targets, the same canonical key fence, lease, and coordinating action — plus a mandatory bounded expiry. Recurring provisional work feeds propose-from-provisional. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "label",
                  "targets"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300,
                    "pattern": "\\S"
                  },
                  "targets": {
                    "type": "object",
                    "minProperties": 1,
                    "maxProperties": 12,
                    "propertyNames": {
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "required": [
                        "kind",
                        "entityId"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "contract",
                            "proposal",
                            "person",
                            "job",
                            "ops_action",
                            "ops_observation",
                            "ops_decision",
                            "ops_work_execution"
                          ]
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200,
                          "pattern": "^[^*?%]+$"
                        }
                      }
                    },
                    "description": "Role key → exactly ONE closed target ref; every provided target composes the canonical identity."
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "phase": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "subjectPersonUserId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "actionTitle": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Begun (or replayed) provisional execution + coordinating action",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "execution",
                    "action",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "execution": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkExecutionMutationRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "action": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsAction"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/work/executions/{executionId}/promote": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "promoteJobOperationsWorkExecution",
        "summary": "Promote provisional work into a DEFINED execution",
        "description": "Atomically supersedes one live provisional execution with a defined execution under the named definition — exact canonical target-set identity is required (promotion never infers from wording), evidence integrity is verified, and the FULL current-version binding is re-verified in-transaction. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "executionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "definitionKey",
                  "targets",
                  "expectedDefinitionBinding"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "targets": {
                    "type": "object",
                    "minProperties": 1,
                    "maxProperties": 12,
                    "propertyNames": {
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "required": [
                        "kind",
                        "entityId"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "contract",
                            "proposal",
                            "person",
                            "job",
                            "ops_action",
                            "ops_observation",
                            "ops_decision",
                            "ops_work_execution"
                          ]
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200,
                          "pattern": "^[^*?%]+$"
                        }
                      }
                    },
                    "description": "Role key → exactly ONE closed target ref; must equal the provisional’s canonical set."
                  },
                  "expectedDefinitionBinding": {
                    "type": "object",
                    "required": [
                      "versionNumber",
                      "contentHash",
                      "coordinationSignature"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "versionNumber": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "contentHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "coordinationSignature": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      }
                    }
                  },
                  "phase": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "subjectPersonUserId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "actionTitle": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Promoted (or replayed) execution + coordinating action",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "execution",
                    "action",
                    "supersededExecutionId",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "execution": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsWorkExecutionMutationRecord"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "action": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsAction"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supersededExecutionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/actions/{actionId}/renew": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "renewJobOperationsAction",
        "summary": "Renew (heartbeat) a LIVE claim lease",
        "description": "Extends a live lease for the bound claimant under the presented unexpired receipt — monotonic (never shortens), statement-clock fenced (no expiry-race resurrection), capped by the pinned definition lease for work-linked actions. Expired leases are takeover territory; exact accepted renewals replay their original receipt. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedActionRevision",
                  "claimReceipt"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "expectedActionRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "claimReceipt": {
                    "type": "string",
                    "minLength": 1
                  },
                  "leaseSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 14400
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Renewed action + fresh receipt (or the honest replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The renewed action (verified reservation projection) plus the FRESH renewal receipt — monotonic, statement-clock fenced, replayable.",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "titleText",
                    "descriptionText",
                    "statusText",
                    "priorityText",
                    "subjectPersonUserId",
                    "assignedOwnerText",
                    "dueAt",
                    "dependsOnJson",
                    "evidenceRefsJson",
                    "claimOwnerText",
                    "claimedByUserId",
                    "claimedAt",
                    "claimExpiresAt",
                    "completedAt",
                    "completedByText",
                    "outcomeText",
                    "canceledAt",
                    "canceledByUserId",
                    "createdByUserId",
                    "sourceSignalId",
                    "signalActionAttemptNumber",
                    "workExecutionId",
                    "handoffReservedForUserId",
                    "handoffReservedByUserId",
                    "handoffReservationExpiresAt",
                    "handoffReservationHandoffId",
                    "handoffReservationInstructions",
                    "revision",
                    "claimReceipt",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "titleText": {
                      "type": "string"
                    },
                    "descriptionText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "statusText": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "CLAIMED",
                        "COMPLETED",
                        "CANCELED"
                      ]
                    },
                    "priorityText": {
                      "type": "string",
                      "enum": [
                        "LOW",
                        "NORMAL",
                        "HIGH",
                        "URGENT"
                      ]
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignedOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "dueAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "dependsOnJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "string"
                      },
                      "description": "Same-context action ids this action depends on."
                    },
                    "evidenceRefsJson": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    },
                    "claimOwnerText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "claimExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "completedByText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outcomeText": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canceledAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "canceledByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdByUserId": {
                      "type": "string"
                    },
                    "sourceSignalId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
                    },
                    "signalActionAttemptNumber": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "workExecutionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
                    },
                    "handoffReservedForUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
                    },
                    "handoffReservedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "handoffReservationHandoffId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "handoffReservationInstructions": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
                      "additionalProperties": false,
                      "required": [
                        "summary",
                        "openItems",
                        "evidenceRefs"
                      ],
                      "properties": {
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 10000
                        },
                        "openItems": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2000
                          }
                        },
                        "evidenceRefs": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "$ref": "#/components/schemas/JobOpsEvidenceRef"
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "description": "Current action revision — send back as expectedActionRevision."
                    },
                    "claimReceipt": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/job-operations/jobs/{jobId}/actions/{actionId}/handoff": {
      "post": {
        "tags": [
          "job-operations"
        ],
        "operationId": "handoffJobOperationsAction",
        "summary": "Hand off a LIVE claim to a named recipient (two-phase, no secret)",
        "description": "In ONE transaction the live claimant records an append-only audit record with the handoff instructions and releases the claim while stamping a visible recipient reservation on the OPEN action. The recipient then authenticates an ordinary claim — no receipt ever transfers. The exclusive window admits ONLY the recipient until expiry, after which the action reopens for everyone. Requires `jobs:write`, a claimed token, canonical per-job employer access (denials read as 404), `Idempotency-Key`, and the current `expectedContextRevision` (stale preconditions are recoverable 409s carrying the current revision). Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedContextRevision",
                  "expectedActionRevision",
                  "claimReceipt",
                  "toUserId",
                  "summary"
                ],
                "additionalProperties": false,
                "properties": {
                  "expectedContextRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "expectedActionRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "claimReceipt": {
                    "type": "string",
                    "minLength": 1
                  },
                  "toUserId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "summary": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "windowSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 14400,
                    "default": 900
                  },
                  "openItems": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    }
                  },
                  "evidenceRefs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    },
                    "description": "Privacy-safe pointers at canonical records — identity, never content."
                  },
                  "actorAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "\\S",
                    "description": "Optional session label for the acting agent. The authenticated caller always remains the actor of record."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Released + reserved action, audit id, window expiry (or replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Two-phase claim handoff outcome: the released OPEN action carrying the visible recipient reservation + verified instructions, the audit record id, and the window expiry. No receipt ever transfers.",
                  "required": [
                    "action",
                    "handoffId",
                    "windowExpiresAt",
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "action": {
                      "$ref": "#/components/schemas/JobOpsAction"
                    },
                    "handoffId": {
                      "type": "string"
                    },
                    "windowExpiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing jobs:write scope, unclaimed agent account, or non-employer token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job (or action/person) not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, state conflict, or idempotency conflict; or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/videos": {
      "get": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.assets.list",
        "summary": "List organization video library assets",
        "description": "Bounded, newest-first listing of the caller organization's shared video library with optional case-insensitive title/filename filter (`q`) and `status` filter. Follow `nextCursor` while `hasMore=true`. Requires `videos:read`, a claimed token, and employer-organization membership (denials read as 404). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "description": "Case-insensitive title/filename filter (bounded server-side)."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "PROCESSING",
                "READY",
                "ERRORED"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paged assets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryAssetsListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:read scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{assetId}": {
      "get": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.assets.get",
        "summary": "One asset with usage counts, a bounded live-reference page, and download state",
        "description": "One asset with its live usage summary, a bounded PAGE of live references (complete via `referencesCursor` continuation — never an unbounded array), and the download-rendition state (`NONE` when never prepared). Requires `videos:read`, a claimed token, and employer-organization membership (denials read as 404). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "referencesCursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "description": "Continue live-reference enumeration; omit for the first page."
          },
          {
            "name": "referencesLimit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Asset detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryAssetGetResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:read scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/uploads": {
      "post": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.assets.prepare_upload",
        "summary": "Prepare a one-time direct-to-provider video upload",
        "description": "One-time direct-to-provider TUS grant; bytes never travel through this API — the caller uploads straight to the provider with the returned `uploadUrl`. Same-key replays return `uploadUrl: null` with `recovery` paths (canonical /api/public/v1/videos/... paths to call verbatim). Requires `videos:write`, a claimed token, employer-organization membership (denials read as 404), and `Idempotency-Key` (same-key retries with the same payload replay the stored result; a changed payload is a 409). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`. Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoLibraryUploadPrepareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload reservation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryUploadPrepareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:write scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset or reference not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{assetId}/upload-status": {
      "get": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.assets.upload_status",
        "summary": "Provider ingest/encode status for an asset",
        "description": "Canonical-state read for an in-flight upload. Provider polling is coalesced; `force=true` bypasses the coalescing interval and re-reads provider truth immediately. Requires `videos:read`, a claimed token, and employer-organization membership (denials read as 404). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "force",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Upload status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryUploadStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:read scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{assetId}/cancel-upload": {
      "post": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.assets.cancel_upload",
        "summary": "Cancel an in-flight upload",
        "description": "Cancels a PENDING/PROCESSING upload and reports a truthful terminal outcome — `ready` means cancel raced READY and the immutable asset was kept. A transient provider-cleanup failure returns a retryable 503 and must be retried with the same Idempotency-Key. Requires `videos:write`, a claimed token, employer-organization membership (denials read as 404), and `Idempotency-Key` (same-key retries with the same payload replay the stored result; a changed payload is a 409). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`. Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "responses": {
          "200": {
            "description": "Cancel outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryUploadCancelResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:write scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset or reference not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/references/attach": {
      "post": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.references.attach",
        "summary": "Place a video in canonical draft content",
        "description": "Atomically inserts a READY video into canonical Instructions or LMS draft content at the supplied stable node identity and reconciles its reference in the same commit. This does not publish a release; MESSAGE placement remains unavailable until canonical send can attach atomically. Requires `videos:write`, a claimed token, employer-organization membership (denials read as 404), and `Idempotency-Key` (same-key retries with the same payload replay the stored result; a changed payload is a 409). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`. Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoLibraryReferenceAttachRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attached reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryReferenceAttachResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:write scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset or reference not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/references/{referenceId}/detach": {
      "post": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.references.detach",
        "summary": "Remove a video from canonical draft content",
        "description": "Atomically removes the exact video node from canonical draft content and detaches its reference. Immutable release/version pins never detach; drafts only. Requires `videos:write`, a claimed token, employer-organization membership (denials read as 404), and `Idempotency-Key` (same-key retries with the same payload replay the stored result; a changed payload is a 409). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`. Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "referenceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "responses": {
          "200": {
            "description": "Detached reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryReferenceDetachResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:write scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset or reference not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{assetId}/download/prepare": {
      "post": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.download.prepare",
        "summary": "Start or refresh preparation of the downloadable MP4 rendition",
        "description": "Asset must be READY. The downloadable artifact is the provider's highest-quality full playable MP4 rendition, not guaranteed byte-identical source. Poll `download/status` until state READY, then mint a grant. Requires `videos:write`, a claimed token, employer-organization membership (denials read as 404), and `Idempotency-Key` (same-key retries with the same payload replay the stored result; a changed payload is a 409). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`. Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "responses": {
          "200": {
            "description": "Download preparation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryDownloadPrepareResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:write scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset or reference not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{assetId}/download/status": {
      "get": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.download.status",
        "summary": "Download-rendition preparation state",
        "description": "Preparation state for the downloadable MP4 rendition. Row absence reads as state `NONE`, never a 404. Requires `videos:read`, a claimed token, and employer-organization membership (denials read as 404). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Download preparation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryDownloadStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:read scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{assetId}/download/grant": {
      "post": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.download.grant",
        "summary": "Mint a short-lived authorized download URL",
        "description": "Audited, employer-only download grant that expires <= 10 minutes after mint. The `videos:download` scope is explicit-mint-only — it is never granted by full-access tokens and must be minted deliberately per token. Requires `videos:download`, a claimed token, employer-organization membership (denials read as 404), and `Idempotency-Key` (same-key retries with the same payload replay the stored result; a changed payload is a 409). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`. Unknown request fields are rejected with 400.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "description": "Client operation key for this consequential write. Retrying the same key with the same payload replays the stored result; reusing it with a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoLibraryDownloadGrantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Short-lived download grant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryDownloadGrantResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:download scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset or reference not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{assetId}/playback": {
      "get": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.playback.get",
        "summary": "Employer playback embed path for an asset",
        "description": "Surface-agnostic employer playback read. Worker playback stays exclusively on each surface's own authorized delivery routes; provider identifiers and raw signed URLs are never exposed. Requires `videos:read`, a claimed token, and employer-organization membership (denials read as 404). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Playback state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryPlaybackGetResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:read scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Asset not found or not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/videos/transcripts/search": {
      "get": {
        "tags": [
          "video-library"
        ],
        "operationId": "video_library.transcripts.search",
        "summary": "Search organization video transcripts",
        "description": "Ranked lexical search over the transcripts of the caller organization's READY, unarchived library videos (language-neutral `simple` text search over the existing transcript index; every word must match; no semantic or AI search). Each match returns only the asset id and title, the matching window's start/end seconds, and a plain-text snippet of at most 240 characters. Operators and punctuation in `q` are inert text. An empty, term-free, or over-long query, or one containing control characters (U+0000–U+001F or U+007F, checked after whitespace is collapsed), fails with 400 `details.videoLibraryCode = search_query_invalid`. Follow `nextCursor` while `hasMore=true`; pages never overlap, and a cursor only continues the exact `q` and `assetId` that issued it (otherwise 409 `conflict` — restart without a cursor). An `assetId` that is malformed (not 1–120 characters of `A-Za-z0-9_-`) or outside the organization is 404 `video_not_found`. Requires `videos:read`, a claimed token, and employer-organization membership (denials read as 404). Default-dark family: while the environment flag is off every call returns 403 `AGENT_SURFACE_DISABLED`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "description": "Transcript words to find (every word must match). Must contain a letter or digit."
          },
          {
            "name": "assetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "description": "Only search this video of the caller organization."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 400
            },
            "description": "`nextCursor` from the previous page of this same `q` and `assetId`."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked transcript matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoLibraryTranscriptSearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query: details.videoLibraryCode=search_query_invalid for an empty, term-free, or over-long q, or a q containing control characters (U+0000-U+001F or U+007F)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing videos:read scope, unclaimed agent account, or family disabled (AGENT_SURFACE_DISABLED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "details.videoLibraryCode=video_not_found: the assetId is malformed (not 1-120 characters of A-Za-z0-9_-) or is not a video of the caller organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The cursor does not belong to this q and assetId; restart without a cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Too many transcript searches for this actor (RATE_LIMITED); retry after details.retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/tools": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "List labeling-tool integrations + your connections",
        "description": "Open Interop (Step 38): the tool roster (per-tool status + sync-depth ceiling T1-T5) and your organization's validated tool connections (connectionId values usable with /integrations/send and /integrations/import). `status` is `available` (every employer can connect the tool from the OpenTrain product), `limited_access` (an employer in the current rollout can connect it from the OpenTrain product), `coming_soon` (no employer can connect it from the OpenTrain product yet) or `enterprise_hold` (on request); it is the same value the /integrate/labeling-tools page shows. Requires `open-label:read`.",
        "responses": {
          "200": {
            "description": "Roster + connections",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or no organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/send": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Send an OpenTrain project to an external labeling tool",
        "description": "Open Interop (Step 38) T3: creates a project in the connected external tool (ontology included) and pushes the Work project's tasks into it. Records a provider project link for sync. Tasks of a redaction workflow or a document collection program are not sent; `withheldCount` counts them, and a project whose every task is withheld answers 409. Requires `open-label:write`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "workProjectId",
                  "connectionId"
                ],
                "properties": {
                  "workProjectId": {
                    "type": "string"
                  },
                  "connectionId": {
                    "type": "string"
                  },
                  "maxTasks": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Send summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Connection or project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Connection not validated, or every task is withheld for redaction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "501": {
            "description": "Tool integration not implemented yet / capability unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "External tool rejected the operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/import": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Import a project from an external labeling tool",
        "description": "Open Interop (Step 38) T2: pulls tasks + annotations from the connected external tool into a NEW Work project (annotations land as editor submissions by default, or as pre-label predictions with annotationMode: PREDICTIONS). Requires `open-label:write`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "connectionId",
                  "externalProjectId"
                ],
                "properties": {
                  "connectionId": {
                    "type": "string"
                  },
                  "externalProjectId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "projectType": {
                    "type": "string"
                  },
                  "annotationMode": {
                    "type": "string",
                    "enum": [
                      "IMPORTED",
                      "PREDICTIONS"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Import summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Connection not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Connection not validated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "501": {
            "description": "Tool integration not implemented yet / capability unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "External tool rejected the operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/computer-use/projects": {
      "post": {
        "tags": [
          "computer-use"
        ],
        "summary": "Launch a computer-use collection project",
        "description": "Step 15 COMPUTER_USE: humans perform real computer tasks — instrumented web sandboxes (LOCAL_WEB), your connected environment (CONNECTION: Archipelago/OpenEnv gateway), or their own desktops (BYO_DESKTOP) — captured as verifiable trajectories with execution-checked rewards. Body: {name, instructions?, envSource?, connectionId?, tasks?[], checkers?}. Requires open-label:write + the computer_use rollout.",
        "responses": {
          "201": {
            "description": "Project launched",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope, feature disabled, or no organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/computer-use/ingest": {
      "post": {
        "tags": [
          "computer-use"
        ],
        "summary": "Push agent trajectories for verification",
        "description": "Verification-as-a-service: push your AGENT's trajectories (format: ATIF | AGENTNET_JSONL | OTEL_SPANS | CUA_SESSION | CUSTOM w/ dot-path fieldMap) into a computer-use project you own. Each lands on the standard grading rails — execution checkers score immediately (computer_use.trajectory.verified webhook) and human review follows. Body: {projectId, format, payload, fieldMap?, defaultCheckerRef?, idempotencyKey?}. idempotencyKey (1-128 chars [A-Za-z0-9.:-]; keyed per project, format-independent) makes retries CONVERGE: the key is reserved atomically, bound to the exact payload (reusing it with different content is a 409), task creation reruns idempotently per source row, and already-stored submissions are recovered through the same finalization. Rows on tasks adjudicated mid-ingest come back as per-row rejections citing the ORIGINAL source index. annotation.created webhooks are at-least-once on recovered retries — dedupe on (annotationId, action). Max 5MB / 500 trajectories. Requires open-label:write.",
        "responses": {
          "200": {
            "description": "Ingested",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or not your project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "idempotencyKey conflict — reused with a different payload, its dataset was archived, or an identical attempt is still in flight (retry shortly)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "computer-use"
        ],
        "summary": "Graded results for pushed trajectories",
        "description": "Per-trajectory checker verdict/reward + human review analyses (geometric-mean rubric, failure category, reward-hack flag). Query: ?projectId=. Requires open-label:read.",
        "responses": {
          "200": {
            "description": "Results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or not your project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/benchmarks/{listingId}/submissions": {
      "post": {
        "tags": [
          "benchmarks"
        ],
        "summary": "Submit pre-generated answers against the public sample",
        "description": "Step 34-E: {modelLabel, outputs: [{itemKey, output}]} graded by the existing tier system against PUBLIC_SAMPLE cases only — held-out cases remain run-but-don't-see. Runs are marked runKind SUBMITTED and never compete with sealed held-out claims.",
        "parameters": [
          {
            "name": "listingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Graded submission run",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "No access, unknown listing, or unmatched outputs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/verify/batches": {
      "post": {
        "tags": [
          "verify"
        ],
        "summary": "Submit model outputs for human verification",
        "description": "Body: {kind: \"rows\"|\"episodes\", items[] (≤200), generator?}. Idempotent per org + content hash. Record-only credit HOLD at create (structured 402 when short), CAPTURE at completion. Emits verify.batch.accepted / verify.batch.completed.",
        "responses": {
          "200": {
            "description": "Batch accepted (duplicate=true on replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid kind or items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credit balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "verify"
        ],
        "summary": "List verification batches",
        "responses": {
          "200": {
            "description": "Batches",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/verify/batches/{batchId}": {
      "get": {
        "tags": [
          "verify"
        ],
        "summary": "Get a verification batch",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch envelope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/verify/batches/{batchId}/results": {
      "get": {
        "tags": [
          "verify"
        ],
        "summary": "Read human verdicts for a batch",
        "description": "Per-item verdicts (ACCEPT / FIX with corrected text / REJECT with reason / PENDING) plus a summary rollup.",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verdicts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/verify/batches/{batchId}/certificate": {
      "get": {
        "tags": [
          "verify"
        ],
        "summary": "Certificate v2 — verifiable human-verification envelope",
        "description": "Composes the Step-20 quality certificate with the gateway verdict distribution: \"humans checked N items\", methodology, provenance. `sha256` is computed over the canonical certificate JSON for offline free-verify (SDK: verify_certificate_hash).",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Certificate + sha256",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/verify/reward": {
      "post": {
        "tags": [
          "verify"
        ],
        "summary": "Score items with the human reward function",
        "description": "Body: {mode: \"judge_now\"|\"human_async\", items: [{prompt, response, id?}], rubric?: string[], model?, trainingRunId?}. judge_now scores synchronously via the LLM judge (buyer BYOK); human_async queues a verify batch — poll GET /verify/reward/{batchId} or subscribe to verify.reward.completed. Reward envelope: {score 0..1, verdict, rationale, mode, judgedBy}.",
        "responses": {
          "200": {
            "description": "Rewards or queued batch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid mode or items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Items already queued with different reward metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/verify/reward/{batchId}": {
      "get": {
        "tags": [
          "verify"
        ],
        "summary": "Poll a human_async reward request",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reward envelopes + mean score",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/verify/run-import": {
      "post": {
        "tags": [
          "verify"
        ],
        "summary": "Import LangSmith / Braintrust runs for verification",
        "description": "Body: {source: \"langsmith\"|\"braintrust\", records[]}. Run inputs/outputs become a verify batch — their annotation queues, our screened + paid workforce.",
        "responses": {
          "200": {
            "description": "Batch accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Unknown source or malformed records",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/verify/trajectories": {
      "post": {
        "tags": [
          "verify"
        ],
        "summary": "Submit your own agent trajectories for verification",
        "description": "API-token lane for labs' own computer-use agents (no device signature; no earnings attach). Body: {projectId, taskId, instruction, steps[] (≤500), privacyReviewed: true, durationMs?}. Lands through the standard Step-15 submit path (checker-at-submit grading, consent + Auto-QA gates).",
        "responses": {
          "200": {
            "description": "Submitted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or submit rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing privacyReviewed attestation or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/computer-use/trajectories": {
      "post": {
        "tags": [
          "computer-use"
        ],
        "summary": "Submit a device-signed desktop trajectory",
        "description": "BYO-desktop lane (paired tracker / DEVICE tokens allowed): {bundleJson, deviceSignature, frames[]}. The device signature is verified over the exact signed bytes; consent + privacy-review attestation are enforced; frames must match their signed hashes. Lands through the standard submit path (checker-at-submit grading).",
        "responses": {
          "200": {
            "description": "Submitted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid bundle or frames",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Signature, consent, or privacy review rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Identify the current token",
        "description": "Returns the token principal: account, actor, scopes, access mode, and claim status. `token.scopes` is always the EFFECTIVE scope set — for `token.accessMode: full_access` keys it is the live expansion of the stored grant (every self-serve scope, never operator-only, admin-restricted only when explicitly granted). `token.fingerprint` (the stable public id segment) and `token.preview` (the masked `ot_pat_…` preview) are NON-SECRET identifiers that say WHICH stored token record is authenticating, matchable against the Developer Settings key list. `restrictedFamilies` reports, per canonical-admin-restricted operation family (e.g. admin-balance hiring), whether this token is actually usable there: `tokenHasScope`, `actorEligible` (live canonical-admin server policy), `surfaceEnabled`, `usable`, a `reason` of `token_missing_scope` | `actor_ineligible` | `surface_disabled`, and a safe `remediation` — no allowlists, org ids, or secrets. `token.restrictedAddOn` (K1.1, present only when the key stores the canonical-admin restricted add-on) reports the coarse live add-on state. `tokenPolicy` (DEV-2544 K1.2) is READ-ONLY policy discovery: how each effective scope was obtained (`inherited` by the live access-mode expansion, `explicit` grant, or contributed by the `restrictedAddOn` on this request), which scopes are deliberately withheld and why (`exclusions`), and the mutation boundary — no public API, CLI, or MCP operation can change a key policy; an employer edits it only in the session-authenticated Developer Settings ceremony, and freelancer keys have a fixed read-only policy.",
        "responses": {
          "200": {
            "description": "Token principal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "token": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "accessMode": {
                          "type": "string",
                          "enum": [
                            "full_access",
                            "worker_full_access",
                            "fine_grained"
                          ]
                        },
                        "restrictedAddOn": {
                          "$ref": "#/components/schemas/PublicApiRestrictedAddOnState"
                        }
                      }
                    },
                    "tokenPolicy": {
                      "$ref": "#/components/schemas/PublicApiTokenPolicyDiagnostics"
                    },
                    "credential": {
                      "type": "object",
                      "description": "DEV-3660: how THIS request was authenticated. `STATIC` is a personal API key; `ROTATING` is a browser-login session (a stable grant whose short-lived access credential rotates). Identities only — `grantId` is the non-secret grant id, `clientKind` the connecting client kind, `resourceKind` the bound audience, and `viaInternalAssertion` is true when the hosted MCP facade presented a server-internal request-bound assertion for this REST hop. Never carries secret material.",
                      "additionalProperties": false,
                      "required": [
                        "mode"
                      ],
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "STATIC",
                            "ROTATING"
                          ]
                        },
                        "grantId": {
                          "type": "string"
                        },
                        "clientKind": {
                          "type": "string",
                          "enum": [
                            "CLI",
                            "STDIO",
                            "HOSTED"
                          ]
                        },
                        "resourceKind": {
                          "type": "string",
                          "enum": [
                            "REST",
                            "MCP"
                          ]
                        },
                        "viaInternalAssertion": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/capabilities": {
      "get": {
        "tags": [
          "discovery"
        ],
        "summary": "Capability discovery",
        "description": "Which API features are enabled for this token (drafting, publishing, hiring, messaging writes, payments, team, credits, webhooks; `time` is the worker time-capture rollout, while `timeSummaries` is true when the token implies `time:read` — buyer project/contract summaries need only that scope plus exact ownership, independent of the rollout), plus accepted draft import formats, update keys, and enums. Works with a bearer token or an in-app session. No specific scope required, and never gated by a single feature flag — a valid token/session always gets the full capability map (each feature reported true/false). The read-only `agentSurfaces` block additionally reports every agent operation family with a four-value status — `disabled` (server flag off), `rollout_gated` (per-actor rollout excludes the actor), `unauthorized` (token grants no family scope), or `available` — plus required vs granted scopes, per-operation `authorized` flags (including `authorized: false` when the token cannot call one), and an exhaustive `syncCoverage` decision (`native`, `bridged`, `conditional`, or `none`; `conditional` attaches only when the caller presents sync headers, and `none` always explains why) so an agent never assumes an uncovered call advances shared context. Operation `kind` is `read`, `mutation`, or `preflight` — `preflight` is the strictly no-write plan step of a mutation: it carries the planned mutation’s non-read scope (so read tokens cannot probe mutation planning) and needs no idempotency key. Canonical-admin-restricted families (e.g. `admin_balance_hire`) also carry a `restricted` diagnostic evaluated from the SAME live server policy as minting and operation time: `tokenHasScope`, `actorEligible`, `surfaceEnabled`, `usable`, a `reason` of `token_missing_scope` | `actor_ineligible` | `surface_disabled`, and a safe `remediation`; when `usable` is false the family is never `available`. Full-access tokens report their live effective scope expansion, never the stored sentinel.",
        "responses": {
          "200": {
            "description": "Capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "agentSurfaces": {
                      "type": "object",
                      "required": [
                        "authorization",
                        "families"
                      ],
                      "properties": {
                        "authorization": {
                          "type": "string",
                          "enum": [
                            "scoped_token",
                            "session"
                          ]
                        },
                        "families": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "family",
                              "status",
                              "scopes",
                              "operations"
                            ],
                            "properties": {
                              "family": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "disabled",
                                  "rollout_gated",
                                  "unauthorized",
                                  "available"
                                ]
                              },
                              "flagKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "rolloutFeatureKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "scopes": {
                                "type": "object",
                                "properties": {
                                  "required": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "granted": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              },
                              "operations": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "id",
                                    "kind",
                                    "authorized",
                                    "syncCoverage",
                                    "agentInferencePlaybooks"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "read",
                                        "mutation",
                                        "preflight"
                                      ]
                                    },
                                    "authorized": {
                                      "type": "boolean"
                                    },
                                    "rollout": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "featureKey",
                                        "enabledForActor"
                                      ],
                                      "description": "Present only for operations the route gates per actor on their own app-feature rollout (e.g. job_instructions.videos.prepare; video status and cancel are not gated, so a held upload can always be read and cancelled). When enabledForActor is false the operation is advertised unauthorized even inside an available family.",
                                      "properties": {
                                        "featureKey": {
                                          "type": "string"
                                        },
                                        "enabledForActor": {
                                          "type": "boolean"
                                        }
                                      }
                                    },
                                    "syncCoverage": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "coverage",
                                        "reason"
                                      ],
                                      "properties": {
                                        "coverage": {
                                          "type": "string",
                                          "enum": [
                                            "native",
                                            "bridged",
                                            "conditional",
                                            "none"
                                          ]
                                        },
                                        "reason": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        }
                                      }
                                    },
                                    "agentInferencePlaybooks": {
                                      "type": "array",
                                      "description": "Agent-inference teachings attached to this read operation. They are product-discovery guidance, never platform detections or write permission.",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "playbookKey",
                                          "guidance",
                                          "capabilityOperationIds"
                                        ],
                                        "properties": {
                                          "playbookKey": {
                                            "type": "string"
                                          },
                                          "guidance": {
                                            "type": "string"
                                          },
                                          "capabilityOperationIds": {
                                            "type": "array",
                                            "items": {
                                              "type": "string"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              "restricted": {
                                "type": "object",
                                "description": "Present only for canonical-admin-restricted families: live-policy usability with a precise, non-secret remediation. When `usable` is false the family status is never `available`.",
                                "required": [
                                  "family",
                                  "requiredScopes",
                                  "tokenHasScope",
                                  "actorEligible",
                                  "surfaceEnabled",
                                  "usable",
                                  "reason",
                                  "remediation"
                                ],
                                "properties": {
                                  "family": {
                                    "type": "string"
                                  },
                                  "requiredScopes": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "tokenHasScope": {
                                    "type": "boolean"
                                  },
                                  "actorEligible": {
                                    "type": "boolean"
                                  },
                                  "surfaceEnabled": {
                                    "type": "boolean"
                                  },
                                  "usable": {
                                    "type": "boolean"
                                  },
                                  "reason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "token_missing_scope",
                                      "actor_ineligible",
                                      "surface_disabled",
                                      null
                                    ]
                                  },
                                  "remediation": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "tokenPolicy": {
                      "description": "DEV-2544 K1.2: read-only policy discovery for the presented token (scope provenance, deliberate exclusions, restricted add-on state, and the session-only mutation boundary). `null` for in-app session actors. Never a mutation surface.",
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PublicApiTokenPolicyDiagnostics"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token/session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/compute/providers": {
      "get": {
        "tags": [
          "compute"
        ],
        "summary": "Compute provider roster",
        "description": "Launchable providers with objectives, sampling mode, base models, and key hints. Requires `compute:read`.",
        "responses": {
          "200": {
            "description": "Provider descriptors",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/training-runs": {
      "get": {
        "tags": [
          "compute"
        ],
        "summary": "List training runs",
        "description": "Requires `compute:read` + the compute feature.",
        "responses": {
          "200": {
            "description": "Training runs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "compute"
        ],
        "summary": "Launch a training run",
        "description": "Launch on a roster provider (your key, your bill). Body: {provider, objective, baseModel, source: {kind: SYNTHETIC_RUN|WORK_PROJECT|INLINE, ...}, epochs?, learningRate?, loraRank?, maxSpendUsd?}. Requires `compute:write`.",
        "responses": {
          "200": {
            "description": "Run queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid launch input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "Provider outcome not locally settled (A60): the job may exist — do NOT relaunch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "error": {
                      "type": "string"
                    },
                    "phase": {
                      "type": "string",
                      "enum": [
                        "ACCEPTED_OR_AMBIGUOUS",
                        "BOUNDARY_UNKNOWN"
                      ]
                    },
                    "runId": {
                      "type": "string"
                    },
                    "recovery": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "error",
                    "phase",
                    "recovery"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/training-runs/external": {
      "post": {
        "tags": [
          "compute"
        ],
        "summary": "Register an externally-trained run (Step 19-ext)",
        "description": "Your training ran on YOUR stack (own Tinker/RunPod account, custom TRL pipeline); registration gives it first-class TrainingRun/TrainedModel identity for evals, webhooks, and model programs. Body: {provider (free text), baseModel, modelHandle, objective?, displayName?, hyperparams?, metrics?, trainedAt?, externalRef? (idempotency), lineage? {projectId, exportId, datasetLicenseId, syntheticRunId}, meta?}. Requires `compute:write`.",
        "responses": {
          "200": {
            "description": "Idempotent replay (created: false)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "201": {
            "description": "Run registered",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "modelId": {
                      "type": "string"
                    },
                    "nextSteps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or lineage reference",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/training-runs/{runId}": {
      "get": {
        "tags": [
          "compute"
        ],
        "summary": "Training run detail",
        "description": "Status, cost, model handle, external registration block (external runs), and linked eval projects. Requires `compute:read`.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Run detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Run not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/training-runs/{runId}/cancel": {
      "post": {
        "tags": [
          "compute"
        ],
        "summary": "Cancel a training run",
        "description": "Best-effort provider cancel. Requires `compute:write`.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cancel accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Run not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/training-runs/{runId}/evaluate": {
      "get": {
        "tags": [
          "compute"
        ],
        "summary": "Eval-setup invocation status (A60 r11 recovery contract)",
        "description": "The durable result-discovery surface behind every 502: the run's latest (or ?invocationId=) eval-setup invocation with status PENDING|RUNNING|COMPLETED|FAILED and, once finished, the evalProjectId. Requires `compute:read`.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invocation status (null when none exists)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "invocation": {
                      "type": "object",
                      "nullable": true,
                      "properties": {
                        "invocationId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "RUNNING",
                            "COMPLETED",
                            "FAILED"
                          ]
                        },
                        "evalProjectId": {
                          "type": "string",
                          "description": "The durable project identity — present in recovery states (RUNNING/FAILED) too, from the fenced payload."
                        },
                        "sampledOutputs": {
                          "type": "number"
                        },
                        "promptsTotal": {
                          "type": "number"
                        },
                        "samplesRecorded": {
                          "type": "number"
                        },
                        "resumable": {
                          "type": "boolean",
                          "description": "On FAILED: true means the paid progress is preserved and a same-idempotency-key POST resumes it; false is terminal."
                        },
                        "error": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "compute"
        ],
        "summary": "Evaluate a tuned model (rails runs)",
        "description": "Samples the tuned model and lands outputs in a sealed HUMAN_EVAL project through a durable pre-admitted invocation (A60 r11). The idempotency key converges retries onto the same invocation; without one each call is a fresh invocation (an active one still refuses to double-sample). External runs are refused here — push outputs via POST /evaluate with experiments[].trainingRunId instead. Requires `compute:write`.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompts": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{4,64}$",
                    "description": "Stable attempt identity — retries with the same key converge on the same paid invocation. Invalid keys are refused (400), never silently replaced."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Eval project created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Run not evaluable (state, sampling mode, or external)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Run not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Terminal invocation outcome (A60 r11): converged — a same-key retry returns this, never re-pays",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "error": {
                      "type": "string"
                    },
                    "phase": {
                      "type": "string",
                      "enum": [
                        "SAMPLING_EXHAUSTED",
                        "SETUP_FAILED"
                      ]
                    },
                    "invocationId": {
                      "type": "string"
                    },
                    "recovery": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "error",
                    "phase",
                    "invocationId",
                    "recovery"
                  ]
                }
              }
            }
          },
          "502": {
            "description": "Setup admitted and finishing automatically (A60 r11): poll GET /training-runs/{runId}/evaluate; never re-sample",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "error": {
                      "type": "string"
                    },
                    "phase": {
                      "type": "string",
                      "enum": [
                        "SETUP_RUNNING",
                        "SETUP_IN_PROGRESS"
                      ]
                    },
                    "invocationId": {
                      "type": "string"
                    },
                    "recovery": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "error",
                    "phase",
                    "invocationId",
                    "recovery"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/evaluate": {
      "get": {
        "tags": [
          "evaluate"
        ],
        "summary": "List evaluation projects (U104)",
        "description": "Principal-scoped HUMAN_EVAL project list — cursor-paginated, newest first. Org-membership visibility parity with the in-app project list; per-project verdict reads stay behind the project_manage capability wall on /results and /status. Requires `open-label:read`.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The nextCursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "One page of evaluation projects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "projects",
                    "nextCursor"
                  ],
                  "properties": {
                    "projects": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "projectId",
                          "name",
                          "mode",
                          "projectType",
                          "status",
                          "createdAt",
                          "updatedAt"
                        ],
                        "properties": {
                          "projectId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "mode": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "SINGLE",
                              "PAIRWISE",
                              "RANKING",
                              "TRAJECTORY",
                              null
                            ]
                          },
                          "projectType": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "limit is not an integer in [1, 100]",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing open-label:read scope, HUMAN_EVAL not enabled, or no employer workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Failed to list evaluation projects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "evaluate"
        ],
        "summary": "Launch a human eval (job + project + experiments)",
        "description": "One call: eval job draft + HUMAN_EVAL project + optional blind import. experiments[]: {label, modelId? (free text), modelVersion?, trainingRunId? (links a rails or external TrainingRun — Step 19-ext), rows: [{itemKey?, prompt, output}] XOR sampleFrom: {baseUrl (https, public), apiKey (used once, never stored), model, prompts[1..25], maxTokens?<=1024, kind?: chat|completion} — we sample YOUR OpenAI-compatible endpoint}. Modes SINGLE|PAIRWISE|RANKING|TRAJECTORY; release gates supported. TRAJECTORY (projectType EVAL_TRAJECTORY; exactly 1 experiment) reviews agent conversations: the experiment carries trajectories: [{itemKey?, messages: [{role: system|developer|user|assistant|tool, content?, tool_calls? (assistant-only: [{id?, function?: {name, arguments}} | {name, arguments}]), tool_call_id?, name?}]}] INSTEAD of rows/sampleFrom — tool calls and tool results expand into positional, reviewable steps. U94: platformExport: {format?: LANGSMITH|BRAINTRUST|WEAVE|PHOENIX (auto-detected when omitted), content: <exported JSON/JSONL>} imports an observability-platform export directly — XOR with experiments; chat/agent runs become TRAJECTORY items, plain prompt/output runs become SINGLE rows; project.mode omitted = inferred from the export (mixed exports refuse without an explicit SINGLE|TRAJECTORY mode); the response carries a platformImport summary {format, mode, recordCount, importedCount, filteredOutCount, skippedCount, skipReasons}. U95: project.template selects a grading template/config preset by id (SINGLE presets: eval-rubric-engineering — the worker AUTHORS a per-item rubric; eval-verifier-authoring — the worker writes and runs checkable verification steps; eval-deep-research-grading — sourcing/citation/coverage/synthesis grading); unknown or wrong-mode ids refuse listing the valid ids for the mode, and the response reports the template actually applied. Requires `jobs:write` + `open-label:write`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "project"
                ],
                "not": {
                  "required": [
                    "experiments",
                    "platformExport"
                  ]
                },
                "properties": {
                  "project": {
                    "type": "object",
                    "required": [
                      "name"
                    ],
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "PAIRWISE",
                          "SINGLE",
                          "RANKING",
                          "TRAJECTORY"
                        ],
                        "description": "Omitted with platformExport = inferred from the export"
                      },
                      "template": {
                        "type": "string",
                        "description": "U95: grading-template id from the mode's registry (config presets: eval-rubric-engineering, eval-verifier-authoring, eval-deep-research-grading — all SINGLE). Unknown or wrong-mode ids refuse with the mode's valid ids; omitted = the mode's default template."
                      },
                      "instructions": {
                        "type": "string"
                      },
                      "gates": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  },
                  "experiments": {
                    "type": "array",
                    "description": "XOR with platformExport",
                    "items": {
                      "type": "object",
                      "required": [
                        "label"
                      ],
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "modelId": {
                          "type": "string"
                        },
                        "modelVersion": {
                          "type": "string"
                        },
                        "trainingRunId": {
                          "type": "string"
                        },
                        "rows": {
                          "type": "array",
                          "description": "Explicit outputs — XOR with sampleFrom/trajectories",
                          "items": {
                            "type": "object",
                            "required": [
                              "prompt",
                              "output"
                            ],
                            "properties": {
                              "itemKey": {
                                "type": "string"
                              },
                              "prompt": {
                                "type": "string"
                              },
                              "output": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "sampleFrom": {
                          "type": "object",
                          "description": "OpenTrain samples YOUR endpoint server-side — XOR with rows",
                          "additionalProperties": true
                        },
                        "trajectories": {
                          "type": "array",
                          "description": "TRAJECTORY mode only (exactly 1 experiment) — XOR with rows/sampleFrom",
                          "items": {
                            "type": "object",
                            "required": [
                              "messages"
                            ],
                            "properties": {
                              "itemKey": {
                                "type": "string"
                              },
                              "messages": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "role"
                                  ],
                                  "properties": {
                                    "role": {
                                      "type": "string",
                                      "enum": [
                                        "system",
                                        "developer",
                                        "user",
                                        "assistant",
                                        "tool"
                                      ]
                                    },
                                    "content": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "tool_calls": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": true
                                      }
                                    },
                                    "tool_call_id": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "platformExport": {
                    "type": "object",
                    "required": [
                      "content"
                    ],
                    "properties": {
                      "format": {
                        "type": "string",
                        "enum": [
                          "LANGSMITH",
                          "BRAINTRUST",
                          "WEAVE",
                          "PHOENIX"
                        ],
                        "description": "Auto-detected from the export when omitted"
                      },
                      "content": {
                        "description": "The exported JSON value, or a JSON/JSONL document string"
                      }
                    }
                  },
                  "job": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "budgetUsd": {
                    "type": "number"
                  },
                  "publish": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Launch result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "launch": {
                      "type": "object",
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "jobStatus": {
                          "type": "string"
                        },
                        "projectId": {
                          "type": "string"
                        },
                        "template": {
                          "type": "string",
                          "nullable": true,
                          "description": "U95: the grading-template id actually applied"
                        },
                        "import": {
                          "type": "object",
                          "additionalProperties": true,
                          "nullable": true
                        },
                        "platformImport": {
                          "type": "object",
                          "properties": {
                            "format": {
                              "type": "string",
                              "enum": [
                                "LANGSMITH",
                                "BRAINTRUST",
                                "WEAVE",
                                "PHOENIX"
                              ]
                            },
                            "mode": {
                              "type": "string",
                              "enum": [
                                "TRAJECTORY",
                                "SINGLE"
                              ]
                            },
                            "recordCount": {
                              "type": "integer"
                            },
                            "importedCount": {
                              "type": "integer"
                            },
                            "filteredOutCount": {
                              "type": "integer"
                            },
                            "skippedCount": {
                              "type": "integer"
                            },
                            "skipReasons": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "draftUrl": {
                          "type": "string",
                          "nullable": true
                        },
                        "jobUrl": {
                          "type": "string",
                          "nullable": true
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "nextSteps": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid experiments, platformExport, mode, gates, or trainingRunId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/evaluate/{projectId}/outputs": {
      "post": {
        "tags": [
          "evaluate"
        ],
        "summary": "Attach model outputs to an eval project",
        "description": "Attach experiment run(s) — explicit experiments (same shape as /evaluate, incl. trainingRunId and rows-XOR-sampleFrom; mode: TRAJECTORY takes experiments[].trajectories message lists — see /evaluate — instead of rows/sampleFrom), a completed Inspect JSON eval log (inspectLog, flaggedOnly?), or an observability-platform export (U94: platformExport {format?, content} — LANGSMITH|BRAINTRUST|WEAVE|PHOENIX, auto-detected when omitted; XOR with experiments and inspectLog; the parsed mode must match the project type; response carries a platformImport summary). Requires `open-label:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Send exactly ONE of experiments, inspectLog, or platformExport",
                "oneOf": [
                  {
                    "required": [
                      "experiments"
                    ]
                  },
                  {
                    "required": [
                      "inspectLog"
                    ]
                  },
                  {
                    "required": [
                      "platformExport"
                    ]
                  }
                ],
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "PAIRWISE",
                      "SINGLE",
                      "RANKING",
                      "TRAJECTORY"
                    ]
                  },
                  "experiments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "label"
                      ],
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "modelId": {
                          "type": "string"
                        },
                        "modelVersion": {
                          "type": "string"
                        },
                        "trainingRunId": {
                          "type": "string"
                        },
                        "rows": {
                          "type": "array",
                          "description": "Explicit outputs — XOR with sampleFrom/trajectories",
                          "items": {
                            "type": "object",
                            "required": [
                              "prompt",
                              "output"
                            ],
                            "properties": {
                              "itemKey": {
                                "type": "string"
                              },
                              "prompt": {
                                "type": "string"
                              },
                              "output": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "sampleFrom": {
                          "type": "object",
                          "description": "OpenTrain samples YOUR endpoint server-side — XOR with rows",
                          "additionalProperties": true
                        },
                        "trajectories": {
                          "type": "array",
                          "description": "TRAJECTORY mode only (exactly 1 experiment) — XOR with rows/sampleFrom",
                          "items": {
                            "type": "object",
                            "required": [
                              "messages"
                            ],
                            "properties": {
                              "itemKey": {
                                "type": "string"
                              },
                              "messages": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "role"
                                  ],
                                  "properties": {
                                    "role": {
                                      "type": "string",
                                      "enum": [
                                        "system",
                                        "developer",
                                        "user",
                                        "assistant",
                                        "tool"
                                      ]
                                    },
                                    "content": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "tool_calls": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "additionalProperties": true
                                      }
                                    },
                                    "tool_call_id": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "inspectLog": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "flaggedOnly": {
                    "type": "boolean"
                  },
                  "platformExport": {
                    "type": "object",
                    "required": [
                      "content"
                    ],
                    "properties": {
                      "format": {
                        "type": "string",
                        "enum": [
                          "LANGSMITH",
                          "BRAINTRUST",
                          "WEAVE",
                          "PHOENIX"
                        ],
                        "description": "Auto-detected from the export when omitted"
                      },
                      "content": {
                        "description": "The exported JSON value, or a JSON/JSONL document string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Import result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "import": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "datasetId": {
                          "type": "string"
                        },
                        "experimentIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "insertedTasks": {
                          "type": "integer"
                        },
                        "platformImport": {
                          "type": "object",
                          "properties": {
                            "format": {
                              "type": "string",
                              "enum": [
                                "LANGSMITH",
                                "BRAINTRUST",
                                "WEAVE",
                                "PHOENIX"
                              ]
                            },
                            "mode": {
                              "type": "string",
                              "enum": [
                                "TRAJECTORY",
                                "SINGLE"
                              ]
                            },
                            "recordCount": {
                              "type": "integer"
                            },
                            "importedCount": {
                              "type": "integer"
                            },
                            "filteredOutCount": {
                              "type": "integer"
                            },
                            "skippedCount": {
                              "type": "integer"
                            },
                            "skipReasons": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid experiments, platformExport, or trainingRunId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/evaluate/{projectId}/status": {
      "get": {
        "tags": [
          "evaluate"
        ],
        "summary": "Eval project status counts (U104)",
        "description": "Cheap task/review state counts for polling loops — never computes the results rollup (use /results for verdicts). Same project_manage capability wall as /results. Requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Project status counts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "status": {
                      "type": "object",
                      "required": [
                        "projectId",
                        "name",
                        "mode",
                        "projectType",
                        "status",
                        "tasks",
                        "reviews",
                        "createdAt",
                        "updatedAt"
                      ],
                      "properties": {
                        "projectId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "mode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "SINGLE",
                            "PAIRWISE",
                            "RANKING",
                            "TRAJECTORY",
                            null
                          ]
                        },
                        "projectType": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "tasks": {
                          "type": "object",
                          "required": [
                            "total",
                            "byTaskStatus"
                          ],
                          "properties": {
                            "total": {
                              "type": "integer"
                            },
                            "byTaskStatus": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "reviews": {
                          "type": "object",
                          "required": [
                            "byReviewStatus"
                          ],
                          "properties": {
                            "byReviewStatus": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing open-label:read scope, HUMAN_EVAL not enabled, no employer workspace, or the token principal lacks the project_manage capability on this project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Evaluation project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Failed to read evaluation project status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/evaluate/{projectId}/corrections": {
      "get": {
        "tags": [
          "evaluate"
        ],
        "summary": "Eval corrections / tracked-diff page (U105)",
        "description": "The corrections (tracked human edits) page — the same rollup module the in-app Reports tab uses, first-class. Cursor-paginated within a stable generation: pass the generationId from the first page while paging; restarted=true means the live set changed and the response is page one of a NEW generation. Same project_manage capability wall as /results. Requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The nextCursor from the previous page."
          },
          {
            "name": "generationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The generationId being paged (from the first read)."
          }
        ],
        "responses": {
          "200": {
            "description": "One corrections page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "corrections"
                  ],
                  "properties": {
                    "corrections": {
                      "type": "object",
                      "required": [
                        "totalCount",
                        "items",
                        "hasMore",
                        "nextCursor",
                        "generationId",
                        "restarted"
                      ],
                      "properties": {
                        "totalCount": {
                          "type": "integer"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "taskId",
                              "annotator",
                              "annotatorKey",
                              "revision",
                              "segments",
                              "stats",
                              "fidelity",
                              "segmentsCapped"
                            ],
                            "properties": {
                              "taskId": {
                                "type": "string"
                              },
                              "annotator": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "annotatorKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "revision": {
                                "type": "integer"
                              },
                              "segments": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "op",
                                    "text"
                                  ],
                                  "properties": {
                                    "op": {
                                      "type": "string",
                                      "enum": [
                                        "equal",
                                        "delete",
                                        "insert"
                                      ]
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  }
                                }
                              },
                              "stats": {
                                "type": "object",
                                "required": [
                                  "deletedChars",
                                  "insertedChars",
                                  "unchangedChars",
                                  "editRatio"
                                ],
                                "properties": {
                                  "deletedChars": {
                                    "type": "integer"
                                  },
                                  "insertedChars": {
                                    "type": "integer"
                                  },
                                  "unchangedChars": {
                                    "type": "integer"
                                  },
                                  "editRatio": {
                                    "type": "number"
                                  }
                                }
                              },
                              "fidelity": {
                                "type": "string",
                                "enum": [
                                  "exact",
                                  "coarse"
                                ]
                              },
                              "segmentsCapped": {
                                "type": "boolean"
                              }
                            }
                          }
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "generationId": {
                          "type": "string"
                        },
                        "restarted": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "cursor is not a valid corrections cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing open-label:read scope, HUMAN_EVAL not enabled, no employer workspace, or the token principal lacks the project_manage capability on this project",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Evaluation project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Failed to read evaluation corrections",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/evaluate/{projectId}/results": {
      "get": {
        "tags": [
          "evaluate"
        ],
        "summary": "Eval results (leaderboard, gates, CIs)",
        "description": "BT/Elo leaderboard, win-rate matrix, per-criterion CIs, gate status. `?format=inspect` returns an Inspect-compatible eval log. Requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "inspect"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/workflow/sourcing": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Per-stage talent sourcing + queue counts",
        "description": "Requires `open-label:read`. Which workflow stages carry their own job posting, cohort restriction, and pay mode (CONTRACT | PER_TASK), plus live per-stage queued-unit counts. Sourcing keys on the STABLE stage key (`stageKey`), never a stage row id.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sourcing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "open-label"
        ],
        "summary": "Upsert one stage's sourcing",
        "description": "Requires `open-label:write` + the `pipeline_builder` feature for the token owner. Body: `{stageKey, role?: ANNOTATOR|REVIEWER, payMode?: CONTRACT|PER_TASK, perTaskCents?, restrictServing?, allowedUserIds?}`. A restricted stage serves ONLY its cohort (manual list ∪ stage hires) — fail closed. Linking a job to a stage is done in-app; hires on a stage job land as stage-scoped assignments automatically.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upserted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid stage key or pay configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/roles": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "List org custom roles (capability bundles)",
        "description": "Requires `open-label:read`. Org-level catalog of custom capability bundles (RBAC Phase 6); any org member may list (holding a bundle grants nothing by itself — enforcement is per project membership). `?includeArchived=true` includes archived bundles (still enforceable on existing memberships, not assignable).",
        "parameters": [
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Roles",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "roles"
                  ],
                  "properties": {
                    "roles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "name",
                          "description",
                          "capabilities",
                          "archivedAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "capabilities": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "archivedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Not an organization member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Create a custom role (org owner only)",
        "description": "Requires `open-label:write`; the token user must be the ORG OWNER. Body: `{name, description?, capabilities}` where capabilities is a non-empty subset of the capability vocabulary (project_read, project_manage, data_import, data_export, data_curate, ontology_edit, members_manage, assignments_manage, labeling_submit, review_decide, reviewer_feedback_submit, automation_manage, comments_create, comments_moderate, reports_read, audit_read); unknown keys are dropped, never granted. Names are unique per org.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "capabilities"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "capabilities": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid name/capabilities or duplicate name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Only the organization owner can manage custom roles",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/roles/{roleId}": {
      "patch": {
        "tags": [
          "open-label"
        ],
        "summary": "Update a custom role (org owner only)",
        "description": "Requires `open-label:write`; org owner only. Partial body of `{name?, description?, capabilities?}`; archived roles refuse edits. Capability changes take effect on the next action of every member holding the bundle.",
        "parameters": [
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, duplicate name, or archived role",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Only the organization owner can manage custom roles",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "open-label"
        ],
        "summary": "Archive a custom role (org owner only)",
        "description": "Requires `open-label:write`; org owner only. Archiving removes the bundle from assignment pickers; existing memberships KEEP the bundle and stay enforceable (reassign members to revoke).",
        "parameters": [
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archived",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Unknown or already archived role",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Only the organization owner can manage custom roles",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/members": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "List project members with effective roles",
        "description": "Requires `open-label:read` + the `members_manage` project capability. Returns `{people}`: org members and explicit memberships with the resolved `effectiveRoleKey` after org-owner / membership / org-default laddering. Role keys: OWNER, ADMIN, MANAGER, REVIEWER, ANNOTATOR, ANNOTATOR_REVIEWER, VIEWER.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "People",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "people"
                  ],
                  "properties": {
                    "people": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "userId",
                          "name",
                          "isOrgMember",
                          "effectiveRoleKey",
                          "membership"
                        ],
                        "properties": {
                          "userId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "isOrgMember": {
                            "type": "boolean"
                          },
                          "effectiveRoleKey": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "membership": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "roleKey": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "customRole": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "description": "Attached capability bundle — the EFFECTIVE capability set when present (roleKey is display fallback).",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "capabilities": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              },
                              "source": {
                                "type": "string"
                              },
                              "pausedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Missing members_manage capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Assign or override a member's project role",
        "description": "Requires `open-label:write` + the `members_manage` project capability. Same core as the Members tab picker. Body: `{userId, roleKey, customRoleId?}` where roleKey is one of the assignable built-ins (ADMIN, MANAGER, REVIEWER, ANNOTATOR, ANNOTATOR_REVIEWER, VIEWER - OWNER is not assignable) and customRoleId optionally attaches an org-defined capability bundle that becomes the effective capability set. Enforcement is capability-based on every plane: e.g. VIEWER cannot export, ANNOTATOR cannot review.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "userId",
                  "roleKey"
                ],
                "properties": {
                  "userId": {
                    "type": "string"
                  },
                  "roleKey": {
                    "type": "string",
                    "enum": [
                      "ADMIN",
                      "MANAGER",
                      "REVIEWER",
                      "ANNOTATOR",
                      "ANNOTATOR_REVIEWER",
                      "VIEWER"
                    ]
                  },
                  "customRoleId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Org-defined capability bundle (custom role). When set, the bundle becomes the effective capability set and roleKey is display fallback; must reference an unarchived role in your organization. Omitting it (or null) with a plain roleKey clears any previous bundle."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Role applied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "roleKey"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "roleKey": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unknown role key or target user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing members_manage capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/tasks": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "List a project's tasks (reviewer discovery included)",
        "description": "Requires `open-label:read`. Employer-org tokens list through the tenant; a contract-derived project REVIEWER lists through their `review_decide` capability instead, and sees ONLY tasks inside their active assignment scope (dataset / batch / task set / slice / workflow stage) — the discovery counterpart of the scope-bounded consensus read. `data` is null while the document is `heldForRedaction` (Step-16 hold).",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tasks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "tasks",
                    "nextCursor"
                  ],
                  "properties": {
                    "tasks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "rowKey",
                          "status",
                          "isLabeled",
                          "annotationCount",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "rowKey": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "isLabeled": {
                            "type": "boolean"
                          },
                          "annotationCount": {
                            "type": "integer"
                          },
                          "data": {},
                          "heldForRedaction": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "No access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/tasks/{taskId}/consensus": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "A task's consensus state + trophy-eligible candidates",
        "description": "Requires `open-label:read`. Employer-org tokens read through the tenant; a contract-derived project REVIEWER reads through their `review_decide` capability, bounded by their active assignment scope. Returns the group (requiredLabelCount, methodology, agreementScore, resolved, resolutionMode, resolvedAt, winningSubmissionId), the live rater ANNOTATION rows only (anonymized `Annotator N`) with their result payloads — `result` is null while the document is `heldForRedaction` (Step-16 hold), and robotics media resolves to the scrubbed artifact — plus `truthInference`, the SAME reliability-weighted Dawid–Skene aggregate the review UI shows (identity-safe: raters labeled `Annotator N`, never user ids; withheld while heldForRedaction).",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Consensus state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "taskId",
                    "group",
                    "submissions",
                    "heldForRedaction",
                    "truthInference"
                  ],
                  "properties": {
                    "taskId": {
                      "type": "string"
                    },
                    "group": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "required": [
                        "requiredLabelCount",
                        "methodology",
                        "agreementScore",
                        "resolved",
                        "resolutionMode",
                        "resolvedAt",
                        "winningSubmissionId"
                      ],
                      "properties": {
                        "requiredLabelCount": {
                          "type": "integer"
                        },
                        "methodology": {
                          "type": "string"
                        },
                        "agreementScore": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "resolved": {
                          "type": "boolean"
                        },
                        "resolutionMode": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "resolvedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "winningSubmissionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "submissions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "annotator",
                          "groundTruth",
                          "createdAt",
                          "result"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "annotator": {
                            "type": "string"
                          },
                          "groundTruth": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "result": {}
                        }
                      }
                    },
                    "heldForRedaction": {
                      "type": "boolean"
                    },
                    "truthInference": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "required": [
                        "perControl",
                        "raterReliability"
                      ],
                      "properties": {
                        "perControl": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "control",
                              "label",
                              "confidence",
                              "posterior"
                            ],
                            "properties": {
                              "control": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "confidence": {
                                "type": "number"
                              },
                              "posterior": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "number"
                                }
                              }
                            }
                          }
                        },
                        "raterReliability": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "annotator",
                              "reliability"
                            ],
                            "properties": {
                              "annotator": {
                                "type": "string"
                              },
                              "reliability": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "No access or outside the review assignment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Adjudicate the consensus group (DETERMINE / REFINE)",
        "description": "Requires `open-label:write` + the `review_decide` capability (contract-derived reviewers are bounded by their assignment scope). Body: `{mode: DETERMINE|REFINE, winningSubmissionId?, resultJson?}`. DETERMINE awards one live rater annotation (from the GET) as ground truth — non-rater layers are refused. REFINE with `resultJson` composes the merged final answer in one transaction (an EMPTY array is the valid no-regions judgment); record-only REFINE requires an already-composed answer. Adjudication refuses until every required rater has submitted and (teleop projects) episode validation is terminal. An identical retry replays idempotently; a resolved group otherwise refuses — supersede by composing a new answer. Restricted reviewers cannot award or resolve on their own annotation.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "mode"
                ],
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "DETERMINE",
                      "REFINE"
                    ]
                  },
                  "winningSubmissionId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "resultJson": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Adjudicated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "taskId",
                    "resolved",
                    "winningSubmissionId"
                  ],
                  "properties": {
                    "taskId": {
                      "type": "string"
                    },
                    "resolved": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "winningSubmissionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "composedSubmissionId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid mode/body, incomplete rater set, pending teleop validation, non-rater winner, or missing composed answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "No access or outside the review assignment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Annotation sealed / version conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/exports": {
      "get": {
        "tags": [
          "exports"
        ],
        "summary": "List recent exports",
        "description": "Requires `open-label:read` + the `data_export` project capability.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exports",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Missing data_export capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "exports"
        ],
        "summary": "Start an async export",
        "description": "Body: {format (e.g. SFT_JSONL, DPO_JSONL), filters?: {statusScope, datasetId, sliceId, anonymizeAnnotators}}. Terminal state fires the `open_label.export.completed` webhook (status COMPLETED|FAILED). Requires `open-label:write` + the `data_export` project capability.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Export started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Unknown format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing data_export capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/exports/latest": {
      "get": {
        "tags": [
          "exports"
        ],
        "summary": "Latest completed export for a format (one-call CI pull)",
        "description": "`?format=SFT_JSONL` → the newest COMPLETED export row + downloadPath. Pairs with the `open_label.export.completed` webhook for pull-on-push CI. Requires `open-label:read` + the `data_export` project capability.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest export",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Unknown format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing data_export capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No completed export for this format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/exports/{exportId}": {
      "get": {
        "tags": [
          "exports"
        ],
        "summary": "Export status + validation report",
        "description": "Requires `open-label:read` + the `data_export` project capability.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Export row",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Missing data_export capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Export not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/exports/{exportId}/download": {
      "get": {
        "tags": [
          "exports"
        ],
        "summary": "Download a completed export",
        "description": "Streams the export bundle with Content-Disposition. Requires `open-label:read` + the `data_export` project capability.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export file stream"
          },
          "403": {
            "description": "Missing data_export capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Export not found or not completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/catalog/assets": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Explore the data catalog",
        "description": "Compound-filtered catalog explore with facets + pagination. Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mediaKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "taskStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "datasetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uniquenessMax",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog page + facets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "facets": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid filters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/catalog/search": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Semantic catalog search (prompt XOR anchors)",
        "description": "Body: {prompt} XOR {anchorAssetIds[]}, plus optional limit and space. Prompt search: space CLIP | TEXT | MIXED (default MIXED — the CLIP joint image/text space AND the mpnet long-text space, merged). Anchor search: multi-anchor mean vectors in ONE space — CLIP (default) or TEXT; MIXED is rejected for anchors. Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked results with similarity scores",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Provide exactly one of `prompt` or `anchorAssetIds`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/catalog/duplicates": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Duplicate review groups",
        "description": "Exact checksum groups + near-duplicate CLIP groups. Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Duplicate groups",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/catalog/embeddings": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Start an asset embedding sweep",
        "description": "Body: {datasetId?}. Starts (or dedupes into) an embedding sweep for the project. Bearer token; requires `open-label:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Sweep started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "deduplicated": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:write` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/catalog/health": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Dataset Health read-model",
        "description": "Coverage, histograms, metadata stats, and potential split leaks (Step 28). Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dataset health",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/catalog/clusters": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Text-corpus clusters",
        "description": "Body: {k? (1-50), titles?}. Deterministic k-means over stored text embeddings; LLM auto-titles are opt-in (Step 28). Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Clusters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "iterations": {
                      "type": "integer"
                    },
                    "clusters": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "k must be an integer between 1 and 50",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/slices": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "List saved slices",
        "description": "Saved slices are dynamic queries — listed with LIVE match counts. Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Slices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Save a slice",
        "description": "Body: {name, filter}. Saves a named catalog filter and returns its live match count. Bearer token; requires `open-label:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Slice created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sliceId": {
                      "type": "string"
                    },
                    "matchCount": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "name is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:write` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/slices/{sliceId}": {
      "delete": {
        "tags": [
          "open-label"
        ],
        "summary": "Delete a saved slice",
        "description": "Bearer token; requires `open-label:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sliceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Slice deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:write` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Slice not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/weak-supervision": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Read the project's labeling functions",
        "description": "Weak supervision (A4-S14): the sandboxed labeling-function configuration. Bearer token; requires `open-label:read` plus project_read capability.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Labeling functions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "functions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "open-label"
        ],
        "summary": "Replace the project's labeling functions",
        "description": "Sandboxed (QuickJS) rules, max 20. Bearer token; requires `open-label:write` plus project_manage; archived projects are read-only. Pass an explicit empty array to clear.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "functions"
                ],
                "properties": {
                  "functions": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "required": [
                        "code"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "enabled": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved functions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "functions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "configFingerprint": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^[0-9a-f]{16}$",
                      "description": "Fingerprint of the just-saved configuration — pin the first apply batch to it."
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid function list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Project archived (read-only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Run weak supervision (preview or apply)",
        "description": "Preview returns coverage/overlap/conflict/gold-accuracy metrics; apply atomically replaces this engine's pending pre-label predictions with majority-vote winners (gold and completed rows excluded; predictions stamped with sourceRunId + config fingerprint). nextCursor continues past the per-run row cap. Bearer token; requires `open-label:write` plus project_manage. Gated by the default-OFF open_label_weak_supervision rollout (404 when disabled); screening projects refuse apply.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "apply": {
                    "type": "boolean"
                  },
                  "maxTasks": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2000
                  },
                  "cursor": {
                    "type": "string"
                  },
                  "expectedFingerprint": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$",
                    "minLength": 16,
                    "maxLength": 16,
                    "description": "Pin later batches to the first batch's configFingerprint — a configuration change between pages aborts instead of mixing rule versions."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Run result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metrics": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "appliedPredictions": {
                      "type": "integer"
                    },
                    "excludedFromApply": {
                      "type": "integer"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "runId": {
                      "type": "string"
                    },
                    "configFingerprint": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or run budget exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Project archived (read-only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/eval-chat/sessions": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Create an eval multimodal chat session",
        "description": "Live model-comparison eval (BIC-A-EVAL-MULTIMODAL-CHAT): 2-10 model configurations, IMMUTABLE once created. LIVE chats real models over the provider client; OFFLINE annotates one imported conversation (sourceTaskId required). Bearer token; requires `open-label:write` plus project_manage (session creation authorizes provider spend via configs/caps). Gated by the default-OFF open_label_eval_multimodal_chat rollout (404 when disabled).",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "title": "LIVE",
                    "type": "object",
                    "required": [
                      "models"
                    ],
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "LIVE"
                        ]
                      },
                      "models": {
                        "type": "array",
                        "minItems": 2,
                        "maxItems": 10,
                        "items": {
                          "type": "object",
                          "required": [
                            "key",
                            "model"
                          ],
                          "properties": {
                            "key": {
                              "type": "string",
                              "description": "1-40 char slug, unique per session."
                            },
                            "model": {
                              "type": "string",
                              "description": "Provider model id."
                            },
                            "systemPrompt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "null/absent = no system prompt (matches the SDK spelling)."
                            }
                          }
                        }
                      },
                      "sourceTaskId": {
                        "type": "null",
                        "description": "null is the legal ABSENT spelling for LIVE sessions."
                      },
                      "maxTurns": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 200
                      },
                      "costCapUsd": {
                        "type": [
                          "number",
                          "null"
                        ],
                        "exclusiveMinimum": 0,
                        "description": "The session closes (CLOSED_BUDGET) once spend reaches this cap — strictly positive; null = uncapped."
                      },
                      "clientRequestKey": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "\\S",
                        "description": "Creation idempotency key: retrying with the same key returns the SAME session (409 if the payload changed) — safe retry after a lost response."
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "title": "OFFLINE",
                    "type": "object",
                    "required": [
                      "mode",
                      "sourceTaskId"
                    ],
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "OFFLINE"
                        ]
                      },
                      "sourceTaskId": {
                        "type": "string",
                        "minLength": 1,
                        "pattern": "\\S",
                        "description": "The imported Labelbox-conversational task of this project. Model configs are DERIVED from the container outputs and the transcript hydrates as turn 1."
                      },
                      "clientRequestKey": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "\\S",
                        "description": "Creation idempotency key: retrying with the same key returns the SAME session (409 if the payload changed) — safe retry after a lost response."
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid model configurations or fields",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Project archived (read-only)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "List the project's eval chat sessions",
        "description": "Newest first, id-cursored. Bearer token; requires `open-label:read` plus project_read. Gated by the default-OFF rollout (404 when disabled).",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A prior page's nextCursor (must be a session of this project)."
          }
        ],
        "responses": {
          "200": {
            "description": "Session page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sessions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid limit or foreign/stale cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/eval-chat/sessions/{sessionId}": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Read the full eval chat transcript",
        "description": "Session state plus ordered messages (with messageId, per-model cost, error kinds, display rotations) and every verdict. Message contentParts use ONLY the public text/image_url shapes: stored images return as FRESH ~600s signed image_url parts minted at read time; image_url.url is null when the stored asset is no longer available. Bearer token; requires `open-label:read` plus `project_read` (reading the transcript is not an export - VIEWERs keep access).",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Transcript",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "verdicts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or session not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/eval-chat/sessions/{sessionId}/turns": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Send one user turn (every configured model answers)",
        "description": "The three-phase locked turn protocol: pass expectedTurn = the session turn count you last saw, and a clientRequestKey so retries collapse onto the original turn instead of double-charging. Model failures record error rows and never abort the turn; stale counts, in-flight fan-outs, closed sessions, and turn/cost caps are retryable 409 conflicts. Bearer token; requires `open-label:write` plus labeling_submit. May run up to ~2 minutes for a full fan-out.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "expectedTurn",
                  "content"
                ],
                "properties": {
                  "expectedTurn": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "content": {
                    "description": "Plain string, or 1-8 parts: {type:text,text} | {type:image_url,image_url:{url}}. image_url.url MUST reference a registered image asset of THIS project in OpenTrain project storage (a Supabase storage object URL for the project). External HTTPS URLs are rejected with 400 — upload the image to the project first."
                  },
                  "clientRequestKey": {
                    "type": "string",
                    "maxLength": 80
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completed turn",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "turnNumber": {
                      "type": "integer"
                    },
                    "displayPositions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "responses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "session": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid content, expectedTurn, or clientRequestKey",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or session not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale turn, in-flight fan-out, closed session, or cap reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/eval-chat/sessions/{sessionId}/verdicts": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Record a frozen-contract verdict",
        "description": "RANKING (turn-level: {order} — a strict permutation of the turn's SUCCESSFUL model keys; the turn must be complete); STEP_REASONING (message-level: {steps} with strictly increasing stepIndex and optional char spans); FACT_CHECK (message-level: one of the six frozen levels); CLASSIFICATION (message- or conversation-level: {name, values} — several NAMED fields may coexist per author/scope; the same name upserts). Bearer token; requires `open-label:write` plus labeling_submit. Verdicts on CLOSED sessions stay allowed.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "taskType",
                  "value"
                ],
                "properties": {
                  "taskType": {
                    "type": "string",
                    "enum": [
                      "RANKING",
                      "STEP_REASONING",
                      "FACT_CHECK",
                      "CLASSIFICATION"
                    ]
                  },
                  "value": {
                    "description": "The frozen payload for the task type."
                  },
                  "turnNumber": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "messageId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored verdict id",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "verdictId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid task type, scope, or frozen payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or session not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Turn still completing (RANKING) or project archived",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/eval-chat/sessions/{sessionId}/close": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Close the eval chat session",
        "description": "Chat mutation stops; verdicts on history stay allowed. An in-flight or incomplete last turn refuses with a retryable 409. Bearer token; requires `open-label:write` plus project_manage.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "closed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or session not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Turn in flight/incomplete, already closed, or project archived",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/eval-chat/sessions/{sessionId}/analytics": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Frozen eval ranking analytics",
        "description": "One observation per (turn, rater) RANKING verdict: per-model wins, win rate (models absent from a ranking are excluded from its denominator), Bernoulli variance p·(1−p), and wins split by the winner's on-screen display position. Bearer token; requires `open-label:read` plus reports_read.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Analytics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "observations": {
                      "type": "integer"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "winsByDisplayPosition": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or session not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/eval-chat/sessions/{sessionId}/export": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "DPO export of the session ranking verdicts",
        "description": "Every (turn, rater) RANKING verdict decomposes into its full pairwise {prompt, chosen, rejected, info} lines — conversational prompts from the USER turns up to the ranked turn, errored responders excluded, image parts as STABLE project-storage refs (never expiring signed URLs). Responses are PAGINATED: each call returns one bounded page; repeat with `cursor` = the returned `nextCursor` until it is null. Sessions with a held imported source refuse with 409. Bearer token; requires `open-label:read` plus the `data_export` project capability.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque continuation token from a prior page nextCursor (omit for the first page). The token pins the ranking snapshot — if verdicts change mid-export the continuation refuses with 409."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            },
            "description": "Max lines per page (default 200; pages also close at a hard UTF-8 byte budget)."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "jsonl"
              ]
            },
            "description": "format=jsonl streams the WHOLE export as application/jsonl with no aggregate size cap (carries lines too large for a JSON page). Pagination params are ignored."
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page of DPO lines (application/json) — or, with format=jsonl, the WHOLE export streamed as newline-delimited application/jsonl.",
            "content": {
              "application/jsonl": {
                "schema": {
                  "type": "string",
                  "description": "Newline-delimited stream: each row is one complete DPO line object ({prompt, chosen, rejected, info})."
                }
              },
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "lines",
                    "nextCursor"
                  ],
                  "properties": {
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "prompt",
                          "chosen",
                          "rejected",
                          "info"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "prompt": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "object",
                              "required": [
                                "role",
                                "content"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "role": {
                                  "type": "string",
                                  "enum": [
                                    "user"
                                  ]
                                },
                                "content": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "chosen": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "object",
                              "required": [
                                "role",
                                "content"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "role": {
                                  "type": "string",
                                  "enum": [
                                    "assistant"
                                  ]
                                },
                                "content": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "rejected": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "object",
                              "required": [
                                "role",
                                "content"
                              ],
                              "additionalProperties": false,
                              "properties": {
                                "role": {
                                  "type": "string",
                                  "enum": [
                                    "assistant"
                                  ]
                                },
                                "content": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "info": {
                            "type": "object",
                            "required": [
                              "session_id",
                              "turn",
                              "annotator",
                              "chosen_model_key",
                              "rejected_model_key",
                              "chosen_message_id",
                              "rejected_message_id"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "session_id": {
                                "type": "string"
                              },
                              "turn": {
                                "type": "integer",
                                "minimum": 1
                              },
                              "annotator": {
                                "type": "string"
                              },
                              "chosen_model_key": {
                                "type": "string"
                              },
                              "rejected_model_key": {
                                "type": "string"
                              },
                              "chosen_message_id": {
                                "type": "string"
                              },
                              "rejected_message_id": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid cursor or limit value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or project capability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or session not found (or feature disabled)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The imported source is under a visibility hold, the ranking set changed mid-export, or a line exceeds the JSON page budget (use format=jsonl)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/datasets/{datasetId}/versions": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "List dataset version snapshots",
        "description": "Immutable content snapshots (Step 28), newest first. Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "datasetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Version snapshots",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "versionText": {
                            "type": "string"
                          },
                          "labelText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rowCount": {
                            "type": "integer"
                          },
                          "contentHashText": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or dataset not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Cut an immutable dataset version",
        "description": "Body: {label?, filters?}. Cuts a content-hashed snapshot of the dataset; fires the `dataset.version_cut` event. Bearer token; requires `open-label:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "datasetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Snapshot cut",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "snapshot": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:write` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or dataset not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/datasets/import": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Import a dataset manifest",
        "description": "CSV, JSON array, or JSON Lines rows — the same manifest core as the app UI: import-policy domain allowlist, row_data caps, sync/async ingest routing (large manifests queue a background ingest run), and idempotency keys (a reused key returns the already-imported dataset). Request bodies are platform-capped (~4 MB) — larger manifests use the signed direct-to-storage lane: POST datasets/import-uploads, PUT the manifest bytes to the returned signedUrl, then import with `manifestStorageKey` instead of `manifestText` (exactly one of the two). Bearer token; requires `open-label:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "oneOf": [
                  {
                    "required": [
                      "manifestText"
                    ],
                    "properties": {
                      "manifestText": {
                        "type": "string"
                      },
                      "manifestStorageKey": {
                        "type": "null"
                      }
                    }
                  },
                  {
                    "required": [
                      "manifestStorageKey"
                    ],
                    "properties": {
                      "manifestStorageKey": {
                        "type": "string"
                      },
                      "manifestText": {
                        "type": "null"
                      }
                    }
                  }
                ],
                "properties": {
                  "manifestText": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Manifest rows as CSV, a JSON array, or JSON Lines. Exactly one of manifestText / manifestStorageKey is required."
                  },
                  "manifestStorageKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Staging key from the import-uploads prepare step (direct-to-storage lane for manifests above the inline body ceiling)."
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Dataset display name."
                  },
                  "idempotencyKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A reused key returns the already-imported dataset instead of importing again."
                  },
                  "tags": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Import result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "dataset": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "queuedTaskCount": {
                      "type": "integer"
                    },
                    "invalidRows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid manifest, policy violation, or reused import key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:write` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/datasets/import-uploads": {
      "post": {
        "tags": [
          "open-label"
        ],
        "summary": "Sign a direct-to-storage manifest upload",
        "description": "Step 1 of the storage lane for manifests above the inline request ceiling: signs a single tenant/project-scoped staging PUT. PUT the raw manifest bytes to `signedUrl` (Content-Type text/plain or text/csv), then POST datasets/import with `manifestStorageKey`. Bearer token; requires `open-label:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sizeBytes"
                ],
                "properties": {
                  "sizeBytes": {
                    "type": "integer",
                    "description": "Declared manifest size in bytes; validated against the 10 MiB storage-lane ceiling before signing (actual bytes are re-checked at import)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Signed upload target",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "storageKey": {
                      "type": "string",
                      "description": "Pass as manifestStorageKey to the import."
                    },
                    "signedUrl": {
                      "type": "string",
                      "description": "PUT the raw manifest bytes here."
                    },
                    "token": {
                      "type": "string"
                    },
                    "maxBytes": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Missing or oversized sizeBytes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:write` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-label/projects/{projectId}/datasets/{datasetId}/versions/diff": {
      "get": {
        "tags": [
          "open-label"
        ],
        "summary": "Diff two version snapshots",
        "description": "Row-key diff by canonical content hash: `?a=` and `?b=` snapshot ids. Bearer token; requires `open-label:read`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "datasetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "a",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "b",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Snapshot diff",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "diff": {
                      "type": "object",
                      "properties": {
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "changed": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "unchanged": {
                          "type": "integer"
                        },
                        "versionA": {
                          "type": "string"
                        },
                        "versionB": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "a and b snapshot ids are required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project or snapshot not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/model-programs": {
      "get": {
        "tags": [
          "model-programs"
        ],
        "summary": "List model programs",
        "description": "Requires `workflow:read` + the workflow feature.",
        "responses": {
          "200": {
            "description": "Programs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "model-programs"
        ],
        "summary": "Create a model program",
        "description": "Body: {name, goal?, domain?, defaultProvider?}. The persistent container for one model effort. Requires `workflow:write`.",
        "responses": {
          "201": {
            "description": "Program created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/model-programs/{programId}": {
      "get": {
        "tags": [
          "model-programs"
        ],
        "summary": "Program detail (passes, referenced runs/evals, cost rollups)",
        "description": "References only — runs/evals stay canonical in their own surfaces. Requires `workflow:read`.",
        "parameters": [
          {
            "name": "programId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Program detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Program not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "model-programs"
        ],
        "summary": "Archive a program (soft — referenced records untouched)",
        "description": "Body: {status: \"ARCHIVED\"}. Requires `workflow:write`.",
        "parameters": [
          {
            "name": "programId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archived",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Program not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/model-programs/{programId}/passes": {
      "post": {
        "tags": [
          "model-programs"
        ],
        "summary": "Start pass v(n+1)",
        "description": "Body: {notes?, trainingRunIds?, evalProjectIds?, rlenvProjectIds?, exportIds?, syntheticRunIds?, datasetLicenseIds?, workflowRunId?} — every id must belong to your organization (references, never copies). External runs (providerText EXTERNAL) are first-class. Requires `workflow:write`.",
        "parameters": [
          {
            "name": "programId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Pass created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "passId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or foreign asset ids",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Program not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/model-programs/{programId}/passes/{passId}": {
      "patch": {
        "tags": [
          "model-programs"
        ],
        "summary": "Update a pass (notes, completion, attach asset refs)",
        "description": "Body: {notes?, status?: COMPLETED|ABANDONED, trainingRunIds?, evalProjectIds?, …}. Completion fires the `model_program.pass_completed` webhook once. Requires `workflow:write`.",
        "parameters": [
          {
            "name": "programId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "passId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pass updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Pass not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/model-programs/{programId}/compare": {
      "get": {
        "tags": [
          "model-programs"
        ],
        "summary": "Compare two passes on a shared evaluation basis",
        "description": "`?a=v1&b=v2[&evalA=&evalB=]`. Comparability: SHARED_PROJECT (BT leaderboard + win rate + criteria deltas), MATCHED_CRITERIA (criterion-intersection deltas; leaderboard honestly withheld across grading pools), INCOMPARABLE (reasons, never a 500). Fires `model_program.eval_compared` (once per pair per day). Requires `workflow:read`.",
        "parameters": [
          {
            "name": "programId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "a",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "b",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Comparison",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Bad selectors",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Program or pass not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/workflow-runs": {
      "post": {
        "tags": [
          "workflow-runs"
        ],
        "summary": "Launch a specialist-model loop",
        "description": "Body: {name, autoOrchestration?: MANUAL|SEMI, entry?: {kind: FRESH|RLENV_PROJECT|GRADED_PROJECT|TRAINING_RUN, projectId?, trainingRunId?}}. Mid-stream entries advance immediately through idempotent readiness checks (an already-SUCCEEDED run lands at TRAINED). Every leg change fires `workflow_run.leg_changed`. Requires `workflow:write`.",
        "responses": {
          "201": {
            "description": "Loop created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workflowRunId": {
                      "type": "string"
                    },
                    "legState": {
                      "type": "string"
                    },
                    "nextSteps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid entry or name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "workflow-runs"
        ],
        "summary": "List specialist loops",
        "description": "Requires `workflow:read`.",
        "responses": {
          "200": {
            "description": "Loops",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/workflow-runs/{workflowRunId}": {
      "get": {
        "tags": [
          "workflow-runs"
        ],
        "summary": "Read one loop",
        "description": "Leg state, references (rlenvProjectId/trainingRunId/evalProjectId), pending SEMI offer, and outcome (eval summary + serve handle after close). Requires `workflow:read`.",
        "parameters": [
          {
            "name": "workflowRunId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Loop",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Loop not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/workflow-runs/{workflowRunId}/advance": {
      "post": {
        "tags": [
          "workflow-runs"
        ],
        "summary": "Advance one leg",
        "description": "Body: {action: ATTACH_ENV|MARK_TRAJECTORIES_READY|ATTACH_RUN|CREATE_EVAL|ATTACH_EVAL|CLOSE, projectId?, trainingRunId?, evalProjectId?, prompts?}. LAUNCH_TRAIN is deliberately absent — launch through POST /training-runs, then ATTACH_RUN. Attaching an already-completed eval advances straight to EVALUATED. Requires `workflow:write`.",
        "parameters": [
          {
            "name": "workflowRunId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "New leg state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Guarded transition refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Loop not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/workflow-runs/{workflowRunId}/cancel": {
      "post": {
        "tags": [
          "workflow-runs"
        ],
        "summary": "Cancel an active loop",
        "description": "Cancels an in-flight training run too (best-effort). Requires `workflow:write`.",
        "parameters": [
          {
            "name": "workflowRunId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canceled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Loop not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already terminal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/engagements": {
      "get": {
        "tags": [
          "engagements"
        ],
        "summary": "List your implementation engagements",
        "description": "The thin Engagement layer over hired implementation contracts. Requires `payments:read`.",
        "responses": {
          "200": {
            "description": "Engagements",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/engagements/{engagementId}": {
      "get": {
        "tags": [
          "engagements"
        ],
        "summary": "One engagement's milestones + client-review verdicts",
        "description": "Milestone deliverable states with the latest ACCEPT/REWORK/REJECT verdicts. Fund/approve through the existing co-signed milestone routes. Requires `payments:read`.",
        "parameters": [
          {
            "name": "engagementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Milestones",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agencies": {
      "get": {
        "tags": [
          "agencies"
        ],
        "summary": "Search the public agency directory",
        "description": "?service=&stack=&vertical=&geo=. Paid tiers list first. Requires `jobs:read`.",
        "responses": {
          "200": {
            "description": "Agencies",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "agencies"
        ],
        "summary": "Create your org's listing (one per org)",
        "description": "Body: {name, tagline?, description?, websiteUrl?, services?, geo?…}. Requires `team:write`.",
        "responses": {
          "201": {
            "description": "Listing created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Org already has a listing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agencies/{slug}": {
      "get": {
        "tags": [
          "agencies"
        ],
        "summary": "Read one public agency listing",
        "description": "Requires `jobs:read`.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Agency",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/operator/status": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Read your operator funnel state",
        "description": "enrolled / status (PENDING|APPROVED|SUSPENDED|BANNED) / active. Requires `operator:read`.",
        "responses": {
          "200": {
            "description": "Funnel state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/operator/apply": {
      "post": {
        "tags": [
          "operator"
        ],
        "summary": "Apply to become a delivery operator (self-serve, owner-only)",
        "description": "Enters the funnel; approval is a deliberate admin decision. Re-applying refreshes the pitch only — it never resets the admin-owned status. Requires `operator:write`.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Application recorded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/operator/projects": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "List cross-client operator projects",
        "description": "Grouped by client label with DRAFT|PRODUCTION stages. Requires `operator:read` + an ACTIVE (approved) operator org for content.",
        "responses": {
          "200": {
            "description": "Grouped projects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "operator"
        ],
        "summary": "Create a client-attributed labeling project",
        "description": "ACTIVE operators only (suspended/banned orgs are refused with 403 parity to the UI); labeling work types only; a client label is required. Requires `operator:write`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "projectType",
                  "clientLabel"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "projectType": {
                    "type": "string",
                    "enum": [
                      "IMAGE_ANNOTATION",
                      "TEXT_ANNOTATION",
                      "DOCUMENT_ANNOTATION",
                      "VIDEO_AUDIO_ANNOTATION",
                      "GENERAL_LABEL_STUDIO"
                    ]
                  },
                  "clientLabel": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "description": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Project created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "projectId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/operator/projects/{projectId}/stage": {
      "post": {
        "tags": [
          "operator"
        ],
        "summary": "Move a client project between DRAFT and PRODUCTION",
        "description": "PRODUCTION enforces the competitive-pilot gate: a pilot round for the project, or an audited admin exemption on the org. Requires `operator:write`.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "stage"
                ],
                "properties": {
                  "stage": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "PRODUCTION"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stage updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/operator/network": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Read your hired-talent roster",
        "description": "Public display names only (never personal emails) with contract counts. Requires `operator:read`.",
        "responses": {
          "200": {
            "description": "Roster",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/operator/fees": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Read your record-only platform-fee summary",
        "description": "Append-only accruals per settled payout (admin-set bps, approval-anchored, synthetic buyers excluded) — NOTHING moves until money-go. Requires `operator:read`.",
        "responses": {
          "200": {
            "description": "Fee summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/deployments": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Deploy a model as a managed endpoint",
        "description": "Body: {name, trainedModelId} (a registered model) OR {name, provider: TINKER|FIREWORKS|CUSTOM, spec: {modelRef, baseUrl?}}. MVP target is BUYER_CLOUD (your key, your bill); OPENTRAIN_MANAGED is launch-gated server-side. Requires `deploy:write`.",
        "responses": {
          "201": {
            "description": "Deployment created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deploymentId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "endpointUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "nextSteps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid source or unreachable endpoint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Managed serving launch-gated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "deployments"
        ],
        "summary": "List deployments",
        "description": "Requires `deploy:read`.",
        "responses": {
          "200": {
            "description": "Deployments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/deployments/{deploymentId}": {
      "get": {
        "tags": [
          "deployments"
        ],
        "summary": "Read one deployment",
        "description": "Status, endpoint, lineage, failure reason. Requires `deploy:read`.",
        "parameters": [
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deployment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/deployments/{deploymentId}/route-inference": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Route one inference call through the deployment",
        "description": "Body: {kind: chat|completion, messages?|prompt?, maxTokens?, temperature?}. The stored provider key attaches server-side and never surfaces; real usage meters into the daily rollup. Requires `deploy:write`.",
        "parameters": [
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Model output + real usage",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "output": {
                      "type": "string"
                    },
                    "usage": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Deployment not LIVE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/deployments/{deploymentId}/pause": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Pause a LIVE deployment",
        "description": "Routing refuses while paused. Requires `deploy:write`.",
        "parameters": [
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paused",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Not LIVE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/deployments/{deploymentId}/resume": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Resume a PAUSED deployment",
        "description": "Requires `deploy:write`.",
        "parameters": [
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resumed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Not paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/deployments/{deploymentId}/teardown": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Tear down a deployment",
        "description": "Adapter teardown, instances stopped, metering ends. Requires `deploy:write`.",
        "parameters": [
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Torn down",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "409": {
            "description": "Already torn down",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/deployments/{deploymentId}/usage": {
      "get": {
        "tags": [
          "deployments"
        ],
        "summary": "Metered daily usage rollups",
        "description": "Tokens in/out, request count, runtime seconds, and record-only accrued cost per UTC day. Requires `deploy:read`.",
        "parameters": [
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage rollups",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/deployments/{deploymentId}/evaluate": {
      "post": {
        "tags": [
          "deployments"
        ],
        "summary": "Continuously evaluate the deployed model (Deploy→Train)",
        "description": "Spawns a standing HUMAN_EVAL project over the deployed model via the durable eval-setup invocation (A60 r11). The idempotency key converges retries onto the same invocation. Poll GET /training-runs/{runId}/evaluate for a 502 result. Requires `deploy:write`.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompts": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{4,64}$",
                    "description": "Stable attempt identity — retries with the same key converge on the same paid invocation. Invalid keys are refused (400), never silently replaced."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Eval project created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "invocationId": {
                      "type": "string"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "evalProjectId": {
                      "type": "string"
                    },
                    "sampledOutputs": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "No registered trained model behind this deployment, OR a terminal invocation outcome (A60 r11): converged — a same-key retry returns this, never re-pays",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "error": {
                      "type": "string"
                    },
                    "phase": {
                      "type": "string",
                      "enum": [
                        "SAMPLING_EXHAUSTED",
                        "SETUP_FAILED"
                      ]
                    },
                    "invocationId": {
                      "type": "string"
                    },
                    "runId": {
                      "type": "string",
                      "description": "The underlying training run — the id GET /training-runs/{runId}/evaluate polls (A60 r13: the deployment surface cannot derive it)."
                    },
                    "recovery": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "error",
                    "phase",
                    "invocationId",
                    "runId",
                    "recovery"
                  ]
                }
              }
            }
          },
          "502": {
            "description": "Setup admitted and finishing automatically (A60 r11): poll GET /training-runs/{runId}/evaluate with the returned runId; never re-sample",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "error": {
                      "type": "string"
                    },
                    "phase": {
                      "type": "string",
                      "enum": [
                        "SETUP_RUNNING",
                        "SETUP_IN_PROGRESS"
                      ]
                    },
                    "invocationId": {
                      "type": "string"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "recovery": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "error",
                    "phase",
                    "invocationId",
                    "runId",
                    "recovery"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/jobs": {
      "get": {
        "tags": [
          "jobs"
        ],
        "security": [],
        "operationId": "listPublicJobs",
        "summary": "List public jobs",
        "description": "Public marketplace job list, paged by cursor. Anonymous: no token is needed, and the endpoint has its own per-IP rate limit. A `q` without `cursor` returns one ranked page (see `GET /jobs/search` for paging). `view=compact` returns `PublicJobSearchHit` jobs (no description, HTML or applyUrl; 1 to 25 a page, default 10) in the same envelope.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Free-text search"
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Category slug from `GET /jobs/facets`."
          },
          {
            "name": "domain",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Subject-matter domain slug from `GET /jobs/facets`."
          },
          {
            "name": "language",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Language tag such as `en` or `fil`."
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "ISO country code"
          },
          {
            "name": "payType",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PAY_PER_HOUR",
                "FIXED_PRICE",
                "PAY_PER_LABEL"
              ]
            }
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "oldest",
                "newest"
              ],
              "default": "oldest"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000
            },
            "description": "Newest-first pages only; a cursor wins over it."
          },
          {
            "name": "view",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "compact"
              ]
            },
            "description": "`compact` returns `PublicJobSearchHit` jobs."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            },
            "description": "Jobs per page. Default view: 1 to 50 (default 50). `view=compact`: 1 to 25 (default 10); larger values are reduced to 25.",
            "x-opentrain-compact-limit": {
              "minimum": 1,
              "maximum": 25,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job list page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/jobs/search": {
      "get": {
        "tags": [
          "jobs"
        ],
        "security": [],
        "operationId": "searchPublicJobs",
        "summary": "Ranked public job search",
        "description": "Hybrid ranked search (semantic, full-text and fuzzy) over public jobs. Anonymous, with its own per-IP rate limit. Without `q` it returns no jobs. The default view returns one page and `nextCursor: null`. `view=compact` returns `PublicJobSearchHit` jobs (1 to 25 a page, default 10) and pages over the ranked top 100 with `cursor`.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Free-text search; required for results."
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Category slug from `GET /jobs/facets`."
          },
          {
            "name": "domain",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Subject-matter domain slug from `GET /jobs/facets`."
          },
          {
            "name": "language",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Language tag such as `en` or `fil`."
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "ISO country code; jobs with no country restriction are included."
          },
          {
            "name": "payType",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PAY_PER_HOUR",
                "FIXED_PRICE",
                "PAY_PER_LABEL"
              ]
            }
          },
          {
            "name": "view",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "compact"
              ]
            },
            "description": "`compact` returns `PublicJobSearchHit` jobs and enables `cursor`."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "`nextCursor` from a previous `view=compact` page of the same search."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Jobs per page. Default view: 1 to 100 (default 50). `view=compact`: 1 to 25 (default 10); larger values are reduced to 25.",
            "x-opentrain-compact-limit": {
              "minimum": 1,
              "maximum": 25,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked job page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/facets": {
      "get": {
        "tags": [
          "jobs"
        ],
        "security": [],
        "summary": "Job search facets",
        "description": "Available categories/languages/countries/pay types for filtering /jobs.",
        "responses": {
          "200": {
            "description": "Facets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/benchmarks": {
      "get": {
        "tags": [
          "benchmarks"
        ],
        "summary": "List published benchmarks",
        "description": "Published held-out benchmarks with title, domain, price, held-out/sample counts, Merkle root, and canary. Requires open-label:read.",
        "responses": {
          "200": {
            "description": "Benchmark list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "benchmarks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/benchmarks/{listingId}": {
      "get": {
        "tags": [
          "benchmarks"
        ],
        "summary": "Benchmark detail",
        "description": "Listing metadata, public sample cases, and your runs when your workspace holds access. Held-out cases are never returned. Requires open-label:read.",
        "parameters": [
          {
            "name": "listingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Benchmark detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/benchmarks/{listingId}/access": {
      "post": {
        "tags": [
          "benchmarks"
        ],
        "summary": "Buy benchmark access",
        "description": "Records the access purchase (billing record + 70/30 creator revenue share) and grants run access. Record-only: nothing is charged until payments go live. Requires payments:write.",
        "parameters": [
          {
            "name": "listingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Purchase recorded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "alreadyOwned": {
                      "type": "boolean"
                    },
                    "grossCents": {
                      "type": "integer"
                    },
                    "settlement": {
                      "type": "string",
                      "enum": [
                        "RECORDED"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/benchmarks/{listingId}/runs": {
      "post": {
        "tags": [
          "benchmarks"
        ],
        "summary": "Run your model against the held-out set",
        "description": "Run-but-don't-see: OpenTrain calls your OpenAI-compatible endpoint over the held-out cases server-side. Your endpoint necessarily receives the held-out prompts; reference answers never leave OpenTrain, and the optional judge tier runs on OpenTrain's side with the model the benchmark creator pinned. The endpoint key is encrypted for this run only and deleted at the terminal state. Each workspace can start at most 10 runs per benchmark in any 30 days (failed runs do not count). Requires open-label:write and benchmark access.",
        "parameters": [
          {
            "name": "listingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "endpointApiKey"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Model identifier at your endpoint"
                  },
                  "endpointBaseUrl": {
                    "type": "string",
                    "description": "OpenAI-compatible https base URL (default https://openrouter.ai/api/v1)"
                  },
                  "endpointApiKey": {
                    "type": "string"
                  },
                  "judge": {
                    "type": "boolean",
                    "description": "Enable the LLM-judge review tier (runs on OpenTrain's side with the creator-pinned judge model; metered, cost + margin)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Run queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string"
                    },
                    "versionNumber": {
                      "type": "integer"
                    },
                    "caseCount": {
                      "type": "integer"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Run limit reached for this benchmark in the last 30 days",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/benchmarks/runs/{runId}": {
      "get": {
        "tags": [
          "benchmarks"
        ],
        "summary": "Benchmark run results",
        "description": "Aggregate scores with bootstrap 95% CIs and per-tier attribution only; categories with fewer than 5 cases are omitted, and no per-case hashes or verdicts are returned. `?format=evidence` returns the one-call evidence pack (version pins, Merkle root, canary, lm-eval summary). Requires open-label:read.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "evidence"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Run results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "benchmarks"
        ],
        "summary": "Opt a run into public leaderboards",
        "description": "Opt one of your own completed endpoint runs into (true) or out of (false) public benchmark leaderboards. Nothing is published without this opt-in, and self-submitted output runs are never ranked. Requires open-label:write.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "leaderboardOptIn"
                ],
                "properties": {
                  "leaderboardOptIn": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Opt-in updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run": {
                      "type": "object",
                      "properties": {
                        "runId": {
                          "type": "string"
                        },
                        "leaderboardOptIn": {
                          "type": "boolean"
                        },
                        "leaderboardOptInAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "leaderboardOptIn must be a boolean",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No completed endpoint run with this id in your workspace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/changes": {
      "get": {
        "tags": [
          "jobs"
        ],
        "security": [],
        "summary": "Public jobs changed since a timestamp",
        "description": "Without `since` (or with a blank one) the answer covers the last 24 hours; its `since` is that time, and its `until` is the next `since`.",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "ISO timestamp to read changes after. Missing or blank: the last 24 hours.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Changed jobs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "A non-blank since that is not an ISO timestamp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/mine": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "List jobs owned by the token account",
        "description": "Requires `jobs:read`.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by job status"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owned jobs page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobs",
                    "nextCursor"
                  ],
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "title",
                          "status",
                          "published",
                          "acceptingApplicants",
                          "createdAt",
                          "updatedAt",
                          "jobUrl",
                          "dashboardUrl",
                          "proposalCounts",
                          "paymentType",
                          "pricePerHour",
                          "pricePerLabel",
                          "fixedPrice",
                          "headcount"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "published": {
                            "type": "boolean"
                          },
                          "acceptingApplicants": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "jobUrl": {
                            "type": "string",
                            "format": "uri"
                          },
                          "dashboardUrl": {
                            "type": "string",
                            "format": "uri"
                          },
                          "proposalCounts": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "total",
                              "unreviewed"
                            ],
                            "properties": {
                              "total": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "unreviewed": {
                                "type": "integer",
                                "minimum": 0
                              }
                            }
                          },
                          "paymentType": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "PAY_PER_HOUR, PAY_PER_LABEL or FIXED_PRICE; the matching rate field applies."
                          },
                          "pricePerHour": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "USD per hour (PAY_PER_HOUR), as in GET /jobs/{id}."
                          },
                          "pricePerLabel": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Client-facing USD per label before the freelancer fee (PAY_PER_LABEL), as in GET /jobs/{id}."
                          },
                          "fixedPrice": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "USD project total (FIXED_PRICE), as in GET /jobs/{id}."
                          },
                          "headcount": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "AI Trainers the job wants to hire."
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}": {
      "get": {
        "tags": [
          "jobs"
        ],
        "security": [],
        "operationId": "getPublicJob",
        "summary": "Get a job",
        "description": "Public detail for marketplace jobs. A closed or non-public job answers 410 `JOB_CLOSED` with `status: \"closed\"` and `changes: \"/api/public/v1/jobs/changes?since=\"` (a blank `since` reads the last 24 hours; with `view=agent` it answers 404 `{id, status: \"closed\"}`). `view=agent` returns `PublicJobAgentDetail` (plain-text description, no HTML or applyUrl).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "agent"
              ]
            },
            "description": "`agent` returns `PublicJobAgentDetail`."
          }
        ],
        "responses": {
          "200": {
            "description": "Job detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "410": {
            "description": "Job closed: take it down",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "jobs"
        ],
        "summary": "Update a published job",
        "description": "Requires `jobs:write` + the `public_api_job_publishing` feature. Accepts the same field patch as `PATCH /job-drafts/{jobId}` but for a live (OPEN) job, and re-runs moderation on the revised listing. A blocked moderation result unpublishes the job back to draft (`409` with details). Screening configuration fields: `aiInterviewRequired` (true | false | null, see `GET /jobs/{id}/configuration`) and `aiInterviewModality` (`VOICE` | `TEXT`).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Update outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "jobId",
                    "status",
                    "moderation"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "OPEN"
                      ]
                    },
                    "moderation": {
                      "type": "object",
                      "properties": {
                        "decision": {
                          "type": "string",
                          "enum": [
                            "ALLOW"
                          ]
                        },
                        "reasons": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "description": "UNSUPPORTED_MARKDOWN per field the live job page would show literally: jobDescription renders only \"#\"/\"##\"/\"###\" headings, \"-\" or \"1.\" lists and **bold**; every other text field is plain text (DEV-4486).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "field": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or not your job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Job is not published, patch is invalid, or moderation blocked the revision (job unpublished back to draft)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/configuration": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Read one owned job configuration + placement (owner-safe)",
        "description": "Requires `jobs:read` and employer access to the job (`job_operations.jobs.get`, DEV-3127/DEV-2982). Canonical owner-safe configuration read: every editable public job field, structured screening fields, AI interview requirements/language/modality, pinned + typed folder placement (`UNGROUPED`/`FOLDERED`), timestamps, and provenance. Contains no candidate, proposal, or provider data, and never reuses the unauthenticated public job DTO. Foreign and missing jobs return one indistinguishable `404`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner job configuration",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "job"
                  ],
                  "properties": {
                    "job": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "title",
                        "status",
                        "published",
                        "acceptingApplicants",
                        "jobUrl",
                        "placement",
                        "descriptions",
                        "aiInterview",
                        "recruitingConfig",
                        "editableFields",
                        "createdAt",
                        "updatedAt",
                        "provenance"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "title": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "published": {
                          "type": "boolean"
                        },
                        "acceptingApplicants": {
                          "type": "boolean"
                        },
                        "jobUrl": {
                          "type": "string"
                        },
                        "placement": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "pinned",
                            "folder"
                          ],
                          "properties": {
                            "pinned": {
                              "type": "boolean"
                            },
                            "folder": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "state",
                                "id"
                              ],
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "UNGROUPED",
                                    "FOLDERED"
                                  ]
                                },
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              }
                            }
                          }
                        },
                        "descriptions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "publicDescription",
                            "labelingOverview",
                            "datasetDescription",
                            "workloadDescription"
                          ],
                          "properties": {
                            "publicDescription": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "labelingOverview": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "datasetDescription": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "workloadDescription": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        },
                        "aiInterview": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "requirements",
                            "language",
                            "modality"
                          ],
                          "properties": {
                            "requirements": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "language": {
                              "type": "string"
                            },
                            "modality": {
                              "type": "string",
                              "enum": [
                                "VOICE",
                                "TEXT"
                              ],
                              "description": "The job’s interview setting (the same value as `editableFields.aiInterviewModality`). VOICE: applicants speak their answers after a consent and microphone check; they cannot switch to typing. TEXT: applicants type their answers in a chat. `effectiveModality` reports what a new applicant gets now."
                            },
                            "effectiveModality": {
                              "type": "string",
                              "enum": [
                                "VOICE",
                                "TEXT"
                              ],
                              "description": "The interview a new applicant gets now. A VOICE setting runs voice only on a speech job OpenTrain keeps on voice, or on a job posted on OpenTrain that was first published or had client activity in the last 30 days; otherwise applicants type. An applicant who already started a voice interview finishes it by voice."
                            },
                            "effectiveModalityReason": {
                              "type": "string",
                              "enum": [
                                "VOICE_OFF",
                                "KEPT_SPEECH_JOB",
                                "PARTNER_IMPORT",
                                "NATIVE_ACTIVE",
                                "NATIVE_QUIET"
                              ],
                              "description": "VOICE_OFF = the job’s voice switch is off or unset. KEPT_SPEECH_JOB = a speech job kept on voice. PARTNER_IMPORT = a job imported from a partner site runs typed. NATIVE_ACTIVE = a job posted on OpenTrain, first published or client-active in the last 30 days. NATIVE_QUIET = a job posted on OpenTrain with neither in the last 30 days."
                            },
                            "required": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "Stored tri-state interview requirement: true = required alongside every other screening step, false = waived, null = legacy rule (required unless an Open Label work assessment suppresses it)."
                            },
                            "effectiveRequired": {
                              "type": "boolean",
                              "description": "Whether applicants must complete the AI interview before submitting a proposal, resolved from `required` exactly as proposal submission does."
                            },
                            "effectiveRequiredReason": {
                              "type": "string",
                              "enum": [
                                "SET_REQUIRED",
                                "SET_NOT_REQUIRED",
                                "DEFAULT_REQUIRED",
                                "DEFAULT_WAIVED_BY_WORK_ASSESSMENT"
                              ],
                              "description": "SET_* = `required` is set on the job. DEFAULT_REQUIRED = `required` is null and the default applies. DEFAULT_WAIVED_BY_WORK_ASSESSMENT = `required` is null and the job’s Open Label work assessment replaces the interview."
                            }
                          }
                        },
                        "recruitingConfig": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "isEnabled",
                            "folderTemplateId",
                            "externalCategoryId",
                            "externalJobReferenceId",
                            "externalSourceUrl",
                            "screeningFields",
                            "exportMode",
                            "requireResume"
                          ],
                          "properties": {
                            "isEnabled": {
                              "type": "boolean"
                            },
                            "folderTemplateId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "externalCategoryId": {
                              "type": "string"
                            },
                            "externalJobReferenceId": {
                              "type": "string"
                            },
                            "externalSourceUrl": {
                              "type": "string"
                            },
                            "screeningFields": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "key",
                                  "label",
                                  "required",
                                  "responseType",
                                  "exportColumn",
                                  "order"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "key": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "required": {
                                    "type": "boolean"
                                  },
                                  "responseType": {
                                    "type": "string",
                                    "enum": [
                                      "url",
                                      "short_text",
                                      "long_text",
                                      "number",
                                      "single_select"
                                    ]
                                  },
                                  "options": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "exportColumn": {
                                    "type": "string"
                                  },
                                  "order": {
                                    "type": "number"
                                  }
                                }
                              }
                            },
                            "exportMode": {
                              "type": "string",
                              "enum": [
                                "SHORTLISTED_ONLY",
                                "ALL_APPLICANTS"
                              ]
                            },
                            "requireResume": {
                              "type": "boolean"
                            }
                          }
                        },
                        "editableFields": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "jobTitle",
                            "jobDescription",
                            "labelingOverview",
                            "datasetDescription",
                            "dataPrelabeled",
                            "dataType",
                            "subjectMatter",
                            "dataVolume",
                            "labelingSoftware",
                            "labelCount",
                            "labelCountTotal",
                            "timeLimitInSeconds",
                            "headcount",
                            "isPerCountry",
                            "isPerLabeler",
                            "budgetRange",
                            "englishLevel",
                            "aiInterviewRequirements",
                            "aiInterviewLanguage",
                            "aiInterviewRequired",
                            "aiInterviewModality",
                            "requireCoderbyteAssessment",
                            "coderbyteAssessmentId",
                            "coderbyteAssessmentUrl",
                            "experienceLevel",
                            "paymentType",
                            "pricePerHour",
                            "pricePerLabel",
                            "fixedPrice",
                            "marketplaceFee",
                            "totalWithFee",
                            "pricePerHourAfterFee",
                            "pricePerLabelAfterFee",
                            "budgetPerLabelTotal",
                            "budgetSizeCategory",
                            "workloadDesc",
                            "timeRequirement",
                            "projectDuration",
                            "freelancerType",
                            "projectScope",
                            "countries",
                            "languages",
                            "dataVolumeUnit",
                            "labelTypes",
                            "visibility",
                            "requireSoftwareExp",
                            "requireDataTypeExp",
                            "requireLabelTypeExp",
                            "requireSubjectMatterExp",
                            "completedSteps",
                            "folderId",
                            "recruitingConfig"
                          ],
                          "properties": {
                            "jobTitle": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "jobDescription": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "labelingOverview": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "datasetDescription": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "dataPrelabeled": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "dataType": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "subjectMatter": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "dataVolume": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "labelingSoftware": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "labelCount": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "labelCountTotal": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "timeLimitInSeconds": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "headcount": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "isPerCountry": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            },
                            "isPerLabeler": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            },
                            "budgetRange": {},
                            "englishLevel": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "aiInterviewRequirements": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "aiInterviewLanguage": {
                              "type": "string"
                            },
                            "aiInterviewRequired": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "true = applicants must complete the AI interview, false = no interview, null = default (required unless the job’s Open Label work assessment replaces it). `GET /jobs/{id}/configuration` reports the effective result as `aiInterview.effectiveRequired`."
                            },
                            "aiInterviewModality": {
                              "type": "string",
                              "enum": [
                                "VOICE",
                                "TEXT"
                              ],
                              "description": "VOICE: spoken interview after a consent and microphone check; applicants cannot switch to typing. TEXT: typed chat interview."
                            },
                            "requireCoderbyteAssessment": {
                              "type": "boolean"
                            },
                            "coderbyteAssessmentId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "coderbyteAssessmentUrl": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "experienceLevel": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "paymentType": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "pricePerHour": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "pricePerLabel": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "fixedPrice": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "marketplaceFee": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "totalWithFee": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "pricePerHourAfterFee": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "pricePerLabelAfterFee": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "budgetPerLabelTotal": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "budgetSizeCategory": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "workloadDesc": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "timeRequirement": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "projectDuration": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "freelancerType": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "projectScope": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "countries": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "languages": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "dataVolumeUnit": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "labelTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "visibility": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "requireSoftwareExp": {
                              "type": "boolean"
                            },
                            "requireDataTypeExp": {
                              "type": "boolean"
                            },
                            "requireLabelTypeExp": {
                              "type": "boolean",
                              "description": "Deprecated and ignored: label-type experience is never a matching requirement. Writes store false; reads return false."
                            },
                            "requiredLabelTypes": {
                              "type": "array",
                              "maxItems": 300,
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 256
                              },
                              "description": "Deprecated and ignored: label-type experience is never a matching requirement. Writes store an empty list; reads return an empty list."
                            },
                            "requireSubjectMatterExp": {
                              "type": "boolean"
                            },
                            "completedSteps": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "folderId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "recruitingConfig": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "isEnabled",
                                "folderTemplateId",
                                "externalCategoryId",
                                "externalJobReferenceId",
                                "externalSourceUrl",
                                "screeningFields",
                                "exportMode",
                                "requireResume"
                              ],
                              "properties": {
                                "isEnabled": {
                                  "type": "boolean"
                                },
                                "folderTemplateId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "externalCategoryId": {
                                  "type": "string"
                                },
                                "externalJobReferenceId": {
                                  "type": "string"
                                },
                                "externalSourceUrl": {
                                  "type": "string"
                                },
                                "screeningFields": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "id",
                                      "key",
                                      "label",
                                      "required",
                                      "responseType",
                                      "exportColumn",
                                      "order"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "key": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      },
                                      "required": {
                                        "type": "boolean"
                                      },
                                      "responseType": {
                                        "type": "string",
                                        "enum": [
                                          "url",
                                          "short_text",
                                          "long_text",
                                          "number",
                                          "single_select"
                                        ]
                                      },
                                      "options": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      },
                                      "exportColumn": {
                                        "type": "string"
                                      },
                                      "order": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                },
                                "exportMode": {
                                  "type": "string",
                                  "enum": [
                                    "SHORTLISTED_ONLY",
                                    "ALL_APPLICANTS"
                                  ]
                                },
                                "requireResume": {
                                  "type": "boolean"
                                }
                              }
                            }
                          }
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "provenance": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "source",
                            "jobUpdatedAt",
                            "recruitingConfigUpdatedAt"
                          ],
                          "properties": {
                            "source": {
                              "type": "string",
                              "enum": [
                                "CANONICAL_JOB"
                              ]
                            },
                            "jobUpdatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "recruitingConfigUpdatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or over-length job id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/shared-logins": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "List the logins kept on one owned job",
        "description": "Requires `jobs:read` and employer access to the job (`jobs.shared_logins.list`). Returns every login on the job (username or email, optional platform, login link and notes, who it is assigned to, and when the worker last revealed it) plus the active hires a login can be assigned to. Names are masked as First L. Passwords are write-only: no response ever contains one, and revealing a password is a human action on the job page only. Foreign and missing jobs return one indistinguishable `404`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Logins on the job",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "logins",
                    "hires"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "logins": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "One login on the job. There is deliberately no password field.",
                        "required": [
                          "id",
                          "platform",
                          "loginUrl",
                          "username",
                          "notes",
                          "assignedTo",
                          "assignedAt",
                          "lastRevealedAt",
                          "createdAt",
                          "updatedAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "platform": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "loginUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "username": {
                            "type": "string"
                          },
                          "notes": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "assignedTo": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "contractId",
                                  "name"
                                ],
                                "properties": {
                                  "contractId": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "Masked as First L."
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assignedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "lastRevealedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "When the assigned worker last revealed the password; null when never."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "hires": {
                      "type": "array",
                      "description": "Active hires on the job a login can be assigned to.",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "contractId",
                          "name"
                        ],
                        "properties": {
                          "contractId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string",
                            "description": "Masked as First L."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or over-length job id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/shared-logins/manage": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Add, edit, assign, unassign, or remove logins on one owned job",
        "description": "Requires `jobs:write`, a verified account, and employer access to the job (`jobs.shared_logins.manage`). One `action` per call: `create` adds 1 to 200 logins (each optionally assigned to an active hire with `assignToContractId`; a job holds at most 500), `update` changes the fields you send (an omitted password stays as it is), `assign` gives a login to one active hire on this job, `unassign` takes it back, and `remove` takes the login off the job (history is kept and the worker loses access). Assigning notifies the worker. The `Idempotency-Key` header is required: the same key and payload replay the original outcome, a changed payload is a `409` `IDEMPOTENCY_KEY_REUSED`. Passwords are write-only: they are encrypted at rest, never returned, and the idempotency receipt binds only a keyed fingerprint of each password. Responses list the affected logins without passwords.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "logins"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "create"
                      },
                      "logins": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 200,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "username",
                            "password"
                          ],
                          "properties": {
                            "username": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 320,
                              "description": "The username or email used to sign in."
                            },
                            "password": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500,
                              "writeOnly": true,
                              "description": "Write-only. Stored encrypted and never returned by any response, receipt, log, or error. Only the employer on the job page or the assigned worker on their own contract can reveal it."
                            },
                            "platform": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 80,
                              "description": "Optional platform or tool name. Empty or null clears it."
                            },
                            "loginUrl": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2000,
                              "description": "Optional login link; must start with http:// or https://. Empty or null clears it."
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 1000,
                              "description": "Optional notes shown to the assigned worker. Empty or null clears them."
                            },
                            "assignToContractId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1,
                              "maxLength": 120,
                              "description": "An active contract on this job. Omit to leave the login unassigned."
                            }
                          }
                        }
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "loginId"
                    ],
                    "description": "Change at least one field. Omitted fields stay as they are; an omitted password is unchanged.",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "update"
                      },
                      "loginId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "username": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 320,
                        "description": "The username or email used to sign in."
                      },
                      "password": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500,
                        "writeOnly": true,
                        "description": "Write-only. Stored encrypted and never returned by any response, receipt, log, or error. Only the employer on the job page or the assigned worker on their own contract can reveal it."
                      },
                      "platform": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 80,
                        "description": "Optional platform or tool name. Empty or null clears it."
                      },
                      "loginUrl": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2000,
                        "description": "Optional login link; must start with http:// or https://. Empty or null clears it."
                      },
                      "notes": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 1000,
                        "description": "Optional notes shown to the assigned worker. Empty or null clears them."
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "loginId",
                      "contractId"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "assign"
                      },
                      "loginId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "contractId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "description": "An active contract on this job."
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "loginId"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "unassign"
                      },
                      "loginId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "loginId"
                    ],
                    "description": "Removes the login from the job. History is kept; the worker loses access.",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "remove"
                      },
                      "loginId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    }
                  }
                ],
                "discriminator": {
                  "propertyName": "action"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Affected logins (no passwords)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "action",
                    "logins",
                    "removedLoginIds",
                    "replayed"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "action": {
                      "type": "string",
                      "enum": [
                        "create",
                        "update",
                        "assign",
                        "unassign",
                        "remove"
                      ]
                    },
                    "logins": {
                      "type": "array",
                      "description": "The affected logins in their current state (empty for remove). No passwords.",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "One login on the job. There is deliberately no password field.",
                        "required": [
                          "id",
                          "platform",
                          "loginUrl",
                          "username",
                          "notes",
                          "assignedTo",
                          "assignedAt",
                          "lastRevealedAt",
                          "createdAt",
                          "updatedAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "platform": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "loginUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "username": {
                            "type": "string"
                          },
                          "notes": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "assignedTo": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "contractId",
                                  "name"
                                ],
                                "properties": {
                                  "contractId": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "Masked as First L."
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assignedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "lastRevealedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "When the assigned worker last revealed the password; null when never."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "removedLoginIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when a same-key retry replayed the original outcome; the rows are re-read in their current state."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or missing Idempotency-Key (issues list field paths only, never values)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or unverified account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or login not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "CONTRACT_NOT_ACTIVE_ON_JOB, JOB_LOGIN_LIMIT_REACHED, IDEMPOTENCY_KEY_REUSED, or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/rows/{jobPersonId}/agent-notes": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Read one person’s job-scoped Agent notes document",
        "description": "Requires `people_table:read`, a claimed account, the `people_table` agent surface and employer access to the job (`people_table.agent_notes.get`). The document is scoped to organization + job + job person — the same person on another job or in another organization has another, isolated document; it is never a global candidate profile and never appears in talent search, profiles, the candidate dossier or worker surfaces. Returns the full Markdown body (an explicit single-person read: roster queries only ever carry state and a bounded preview), `version`/`etag` for optimistic writes, actor metadata, the last source references, the caller’s permission bit and the agent behaviour contract. Read it before substantive work with this person; update it after a material, durable learning — not after every message. Names are masked \"First L.\"; the person is addressed by `jobPersonId`. A job or job person the caller cannot reach reads exactly like a missing one (`404`).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "jobPersonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "document",
                    "guidance"
                  ],
                  "properties": {
                    "document": {
                      "type": "object",
                      "additionalProperties": false,
                      "description": "One person’s job-scoped Agent notes. `version` is 0 and `etag` null while EMPTY; an ARCHIVED document keeps its version and history but has an empty body until the next append/replace.",
                      "required": [
                        "jobId",
                        "jobPersonId",
                        "displayName",
                        "state",
                        "version",
                        "etag",
                        "bodyMarkdown",
                        "sizeChars",
                        "limitChars",
                        "preview",
                        "createdAt",
                        "updatedAt",
                        "archivedAt",
                        "createdBy",
                        "updatedBy",
                        "lastSourceReferences",
                        "permissions"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "jobPersonId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked \"First L.\" — presentation only; address the person by jobPersonId."
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "EMPTY",
                            "ACTIVE",
                            "ARCHIVED"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "etag": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "sha256 of the current body; the optimistic ETag."
                        },
                        "bodyMarkdown": {
                          "type": "string",
                          "maxLength": 32000
                        },
                        "sizeChars": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "limitChars": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "preview": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 160,
                          "description": "Bounded, Markdown-stripped first line(s); null when EMPTY/ARCHIVED."
                        },
                        "createdAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "createdBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "updatedBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastSourceReferences": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "id"
                            ],
                            "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "proposal",
                                  "conversation",
                                  "message",
                                  "interview",
                                  "assessment",
                                  "contract",
                                  "project_todo",
                                  "training",
                                  "manual"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64,
                                "description": "Null only for `manual`."
                              }
                            }
                          }
                        },
                        "permissions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "canWrite",
                            "canArchive",
                            "canReadHistoryContent"
                          ],
                          "description": "The caller’s capability on this document (the `agentNotes` permission bit): write and archive need `people_table:write`; revision content is separately authorized by the same scope.",
                          "properties": {
                            "canWrite": {
                              "type": "boolean"
                            },
                            "canArchive": {
                              "type": "boolean"
                            },
                            "canReadHistoryContent": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "guidance": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The agent behaviour contract, restated on every read."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or over-length ids",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "jobs"
        ],
        "summary": "Replace one person’s Agent notes document (optimistic)",
        "description": "Requires `people_table:write`, a verified account and employer access to the job (`people_table.agent_notes.replace`). Replaces the whole Markdown document at `expectedVersion` (0 creates it). The `Idempotency-Key` header (8–128 chars) is required: the same key and payload replay the original outcome; a changed payload is a `409` `IDEMPOTENCY_KEY_REUSED`. The server refuses, with structured value-free diagnostics, a stale version (`409` VERSION_MISMATCH with the current version/etag), an empty or oversized body, raw HTML or script-capable links (`UNSAFE_MARKDOWN`), the person’s full name, surname, e-mail or phone-looking strings in the body or the reason (`CONTENT_LEAK`: one generic refusal naming no line, kind or field, audited hash-only), and a source reference that is not this person’s record on this job (`INVALID_SOURCE_REFERENCE`). Each write that passes every other check spends one attempt of the account’s write budget (10 writes per hour across all jobs, shared by the web and API surfaces; an exact replay or an earlier refusal spends nothing); once it is spent, every write is `429` RATE_LIMITED until the window moves. Every write records an append-only revision (actor + kind, surface, request id, idempotency key, before/after hashes, references, reason). Nothing runs in the background: writes are explicit.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "jobPersonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "bodyMarkdown",
                  "expectedVersion"
                ],
                "properties": {
                  "bodyMarkdown": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64000,
                    "description": "The whole new document. At most 32000 characters after normalization (CRLF → LF, trailing whitespace trimmed); the raw value may be up to twice that. Use the masked name or ids, never a full name, e-mail or phone number; no raw HTML."
                  },
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The version you read (0 for an EMPTY document). A stale value is a 409 VERSION_MISMATCH carrying currentVersion/currentEtag."
                  },
                  "sourceReferences": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "kind",
                        "id"
                      ],
                      "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "proposal",
                            "conversation",
                            "message",
                            "interview",
                            "assessment",
                            "contract",
                            "project_todo",
                            "training",
                            "manual"
                          ]
                        },
                        "id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 64,
                          "description": "Null only for `manual`."
                        }
                      }
                    }
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500,
                    "description": "Optional audited reason (recorded on the revision)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The document after the write and its revision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "document",
                    "revision",
                    "replayed",
                    "nextSteps"
                  ],
                  "properties": {
                    "document": {
                      "type": "object",
                      "additionalProperties": false,
                      "description": "One person’s job-scoped Agent notes. `version` is 0 and `etag` null while EMPTY; an ARCHIVED document keeps its version and history but has an empty body until the next append/replace.",
                      "required": [
                        "jobId",
                        "jobPersonId",
                        "displayName",
                        "state",
                        "version",
                        "etag",
                        "bodyMarkdown",
                        "sizeChars",
                        "limitChars",
                        "preview",
                        "createdAt",
                        "updatedAt",
                        "archivedAt",
                        "createdBy",
                        "updatedBy",
                        "lastSourceReferences",
                        "permissions"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "jobPersonId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked \"First L.\" — presentation only; address the person by jobPersonId."
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "EMPTY",
                            "ACTIVE",
                            "ARCHIVED"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "etag": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "sha256 of the current body; the optimistic ETag."
                        },
                        "bodyMarkdown": {
                          "type": "string",
                          "maxLength": 32000
                        },
                        "sizeChars": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "limitChars": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "preview": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 160,
                          "description": "Bounded, Markdown-stripped first line(s); null when EMPTY/ARCHIVED."
                        },
                        "createdAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "createdBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "updatedBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastSourceReferences": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "id"
                            ],
                            "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "proposal",
                                  "conversation",
                                  "message",
                                  "interview",
                                  "assessment",
                                  "contract",
                                  "project_todo",
                                  "training",
                                  "manual"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64,
                                "description": "Null only for `manual`."
                              }
                            }
                          }
                        },
                        "permissions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "canWrite",
                            "canArchive",
                            "canReadHistoryContent"
                          ],
                          "description": "The caller’s capability on this document (the `agentNotes` permission bit): write and archive need `people_table:write`; revision content is separately authorized by the same scope.",
                          "properties": {
                            "canWrite": {
                              "type": "boolean"
                            },
                            "canArchive": {
                              "type": "boolean"
                            },
                            "canReadHistoryContent": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "version",
                        "action",
                        "createdAt",
                        "actor",
                        "surface",
                        "requestId",
                        "idempotencyKey",
                        "reason",
                        "beforeEtag",
                        "afterEtag",
                        "sizeChars",
                        "sourceReferences",
                        "content"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "CREATE",
                            "APPEND",
                            "REPLACE",
                            "ARCHIVE"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "actor": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "userId",
                            "kind"
                          ],
                          "properties": {
                            "userId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "USER",
                                "AGENT",
                                "SYSTEM"
                              ]
                            }
                          }
                        },
                        "surface": {
                          "type": "string",
                          "enum": [
                            "WEB",
                            "API"
                          ]
                        },
                        "requestId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "idempotencyKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 500
                        },
                        "beforeEtag": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "afterEtag": {
                          "type": "string"
                        },
                        "sizeChars": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "sourceReferences": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "id"
                            ],
                            "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "proposal",
                                  "conversation",
                                  "message",
                                  "interview",
                                  "assessment",
                                  "contract",
                                  "project_todo",
                                  "training",
                                  "manual"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64,
                                "description": "Null only for `manual`."
                              }
                            }
                          }
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "bodyMarkdown",
                                "appendedMarkdown"
                              ],
                              "properties": {
                                "bodyMarkdown": {
                                  "type": "string",
                                  "maxLength": 32000,
                                  "description": "The whole document as it stood after this revision."
                                },
                                "appendedMarkdown": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 8000,
                                  "description": "For APPEND: exactly what was added; null otherwise."
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Present only when revision content was requested AND authorized."
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when the Idempotency-Key replayed the stored outcome."
                    },
                    "nextSteps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or Idempotency-Key, BODY_EMPTY, BODY_TOO_LARGE, UNSAFE_MARKDOWN, CONTENT_LEAK (generic, no details), INVALID_SOURCE_REFERENCE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unverified account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH (details.currentVersion / currentEtag), IDEMPOTENCY_KEY_REUSED, or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: this account spent its Agent notes write budget (10 writes per hour across all jobs, shared by the web and API surfaces); retry after details.retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/rows/{jobPersonId}/agent-notes/append": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Append a source-referenced observation to one person’s Agent notes",
        "description": "Requires `people_table:write`, a verified account and employer access to the job (`people_table.agent_notes.append`). Adds `appendMarkdown` after the current body (separated by a blank line; 0 as `expectedVersion` creates the document; an archived document is re-activated). Same `Idempotency-Key`, validation, diagnostics and revision rules as the replace; the appended text is also kept on the revision. Attach bounded source references (proposal, conversation/message, interview, assessment, contract, Project To-do, training, or manual) — they must belong to this person on this job.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "jobPersonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "appendMarkdown",
                  "expectedVersion"
                ],
                "properties": {
                  "appendMarkdown": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000,
                    "description": "The observation/section to add; the server separates it with a blank line and never rewrites what is already there. At most 8000 characters after normalization (CRLF → LF, trailing whitespace trimmed); the raw value may be up to twice that. Use the masked name or ids, never a full name, e-mail or phone number; no raw HTML."
                  },
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The version you read (0 for an EMPTY document). A stale value is a 409 VERSION_MISMATCH carrying currentVersion/currentEtag."
                  },
                  "sourceReferences": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "kind",
                        "id"
                      ],
                      "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "proposal",
                            "conversation",
                            "message",
                            "interview",
                            "assessment",
                            "contract",
                            "project_todo",
                            "training",
                            "manual"
                          ]
                        },
                        "id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 64,
                          "description": "Null only for `manual`."
                        }
                      }
                    }
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500,
                    "description": "Optional audited reason (recorded on the revision)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The document after the write and its revision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "document",
                    "revision",
                    "replayed",
                    "nextSteps"
                  ],
                  "properties": {
                    "document": {
                      "type": "object",
                      "additionalProperties": false,
                      "description": "One person’s job-scoped Agent notes. `version` is 0 and `etag` null while EMPTY; an ARCHIVED document keeps its version and history but has an empty body until the next append/replace.",
                      "required": [
                        "jobId",
                        "jobPersonId",
                        "displayName",
                        "state",
                        "version",
                        "etag",
                        "bodyMarkdown",
                        "sizeChars",
                        "limitChars",
                        "preview",
                        "createdAt",
                        "updatedAt",
                        "archivedAt",
                        "createdBy",
                        "updatedBy",
                        "lastSourceReferences",
                        "permissions"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "jobPersonId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked \"First L.\" — presentation only; address the person by jobPersonId."
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "EMPTY",
                            "ACTIVE",
                            "ARCHIVED"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "etag": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "sha256 of the current body; the optimistic ETag."
                        },
                        "bodyMarkdown": {
                          "type": "string",
                          "maxLength": 32000
                        },
                        "sizeChars": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "limitChars": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "preview": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 160,
                          "description": "Bounded, Markdown-stripped first line(s); null when EMPTY/ARCHIVED."
                        },
                        "createdAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "createdBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "updatedBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastSourceReferences": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "id"
                            ],
                            "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "proposal",
                                  "conversation",
                                  "message",
                                  "interview",
                                  "assessment",
                                  "contract",
                                  "project_todo",
                                  "training",
                                  "manual"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64,
                                "description": "Null only for `manual`."
                              }
                            }
                          }
                        },
                        "permissions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "canWrite",
                            "canArchive",
                            "canReadHistoryContent"
                          ],
                          "description": "The caller’s capability on this document (the `agentNotes` permission bit): write and archive need `people_table:write`; revision content is separately authorized by the same scope.",
                          "properties": {
                            "canWrite": {
                              "type": "boolean"
                            },
                            "canArchive": {
                              "type": "boolean"
                            },
                            "canReadHistoryContent": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "version",
                        "action",
                        "createdAt",
                        "actor",
                        "surface",
                        "requestId",
                        "idempotencyKey",
                        "reason",
                        "beforeEtag",
                        "afterEtag",
                        "sizeChars",
                        "sourceReferences",
                        "content"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "CREATE",
                            "APPEND",
                            "REPLACE",
                            "ARCHIVE"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "actor": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "userId",
                            "kind"
                          ],
                          "properties": {
                            "userId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "USER",
                                "AGENT",
                                "SYSTEM"
                              ]
                            }
                          }
                        },
                        "surface": {
                          "type": "string",
                          "enum": [
                            "WEB",
                            "API"
                          ]
                        },
                        "requestId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "idempotencyKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 500
                        },
                        "beforeEtag": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "afterEtag": {
                          "type": "string"
                        },
                        "sizeChars": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "sourceReferences": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "id"
                            ],
                            "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "proposal",
                                  "conversation",
                                  "message",
                                  "interview",
                                  "assessment",
                                  "contract",
                                  "project_todo",
                                  "training",
                                  "manual"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64,
                                "description": "Null only for `manual`."
                              }
                            }
                          }
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "bodyMarkdown",
                                "appendedMarkdown"
                              ],
                              "properties": {
                                "bodyMarkdown": {
                                  "type": "string",
                                  "maxLength": 32000,
                                  "description": "The whole document as it stood after this revision."
                                },
                                "appendedMarkdown": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 8000,
                                  "description": "For APPEND: exactly what was added; null otherwise."
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Present only when revision content was requested AND authorized."
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when the Idempotency-Key replayed the stored outcome."
                    },
                    "nextSteps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or Idempotency-Key, BODY_EMPTY, APPEND_TOO_LARGE, BODY_TOO_LARGE (the result would exceed the limit), UNSAFE_MARKDOWN, CONTENT_LEAK, INVALID_SOURCE_REFERENCE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unverified account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH (details.currentVersion / currentEtag), IDEMPOTENCY_KEY_REUSED, or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: this account spent its Agent notes write budget (10 writes per hour across all jobs, shared by the web and API surfaces); retry after details.retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/rows/{jobPersonId}/agent-notes/archive": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Archive (clear) one person’s Agent notes — confirmed, kept in history",
        "description": "Requires `people_table:write`, a verified account and employer access to the job (`people_table.agent_notes.archive`). The confirmed destructive lifecycle: `confirm` must be literally true; the body is cleared, the version advances, and every prior body stays in the revision history (there is no hard delete on any agent surface; the next append/replace re-activates the document). Same `Idempotency-Key` rules as the other writes. `409` ALREADY_ARCHIVED / NOTHING_TO_ARCHIVE / VERSION_MISMATCH.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "jobPersonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedVersion",
                  "confirm"
                ],
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "The version you read (0 for an EMPTY document). A stale value is a 409 VERSION_MISMATCH carrying currentVersion/currentEtag."
                  },
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ],
                    "description": "Must be literally true; the body is cleared and kept only in history."
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500,
                    "description": "Optional audited reason (recorded on the revision)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The archived document and its revision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "document",
                    "revision",
                    "replayed",
                    "nextSteps"
                  ],
                  "properties": {
                    "document": {
                      "type": "object",
                      "additionalProperties": false,
                      "description": "One person’s job-scoped Agent notes. `version` is 0 and `etag` null while EMPTY; an ARCHIVED document keeps its version and history but has an empty body until the next append/replace.",
                      "required": [
                        "jobId",
                        "jobPersonId",
                        "displayName",
                        "state",
                        "version",
                        "etag",
                        "bodyMarkdown",
                        "sizeChars",
                        "limitChars",
                        "preview",
                        "createdAt",
                        "updatedAt",
                        "archivedAt",
                        "createdBy",
                        "updatedBy",
                        "lastSourceReferences",
                        "permissions"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "jobPersonId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "displayName": {
                          "type": "string",
                          "description": "Masked \"First L.\" — presentation only; address the person by jobPersonId."
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "EMPTY",
                            "ACTIVE",
                            "ARCHIVED"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "etag": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "sha256 of the current body; the optimistic ETag."
                        },
                        "bodyMarkdown": {
                          "type": "string",
                          "maxLength": 32000
                        },
                        "sizeChars": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "limitChars": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "preview": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 160,
                          "description": "Bounded, Markdown-stripped first line(s); null when EMPTY/ARCHIVED."
                        },
                        "createdAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "createdBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "updatedBy": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "userId",
                                "kind"
                              ],
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "USER",
                                    "AGENT",
                                    "SYSTEM"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastSourceReferences": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "id"
                            ],
                            "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "proposal",
                                  "conversation",
                                  "message",
                                  "interview",
                                  "assessment",
                                  "contract",
                                  "project_todo",
                                  "training",
                                  "manual"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64,
                                "description": "Null only for `manual`."
                              }
                            }
                          }
                        },
                        "permissions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "canWrite",
                            "canArchive",
                            "canReadHistoryContent"
                          ],
                          "description": "The caller’s capability on this document (the `agentNotes` permission bit): write and archive need `people_table:write`; revision content is separately authorized by the same scope.",
                          "properties": {
                            "canWrite": {
                              "type": "boolean"
                            },
                            "canArchive": {
                              "type": "boolean"
                            },
                            "canReadHistoryContent": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "revision": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "version",
                        "action",
                        "createdAt",
                        "actor",
                        "surface",
                        "requestId",
                        "idempotencyKey",
                        "reason",
                        "beforeEtag",
                        "afterEtag",
                        "sizeChars",
                        "sourceReferences",
                        "content"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "CREATE",
                            "APPEND",
                            "REPLACE",
                            "ARCHIVE"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "actor": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "userId",
                            "kind"
                          ],
                          "properties": {
                            "userId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "USER",
                                "AGENT",
                                "SYSTEM"
                              ]
                            }
                          }
                        },
                        "surface": {
                          "type": "string",
                          "enum": [
                            "WEB",
                            "API"
                          ]
                        },
                        "requestId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "idempotencyKey": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 500
                        },
                        "beforeEtag": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "afterEtag": {
                          "type": "string"
                        },
                        "sizeChars": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "sourceReferences": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "id"
                            ],
                            "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "proposal",
                                  "conversation",
                                  "message",
                                  "interview",
                                  "assessment",
                                  "contract",
                                  "project_todo",
                                  "training",
                                  "manual"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64,
                                "description": "Null only for `manual`."
                              }
                            }
                          }
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "bodyMarkdown",
                                "appendedMarkdown"
                              ],
                              "properties": {
                                "bodyMarkdown": {
                                  "type": "string",
                                  "maxLength": 32000,
                                  "description": "The whole document as it stood after this revision."
                                },
                                "appendedMarkdown": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 8000,
                                  "description": "For APPEND: exactly what was added; null otherwise."
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Present only when revision content was requested AND authorized."
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when the Idempotency-Key replayed the stored outcome."
                    },
                    "nextSteps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or Idempotency-Key, CONFIRM_REQUIRED, or CONTENT_LEAK in the reason (generic, no details)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unverified account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH, ALREADY_ARCHIVED, NOTHING_TO_ARCHIVE, IDEMPOTENCY_KEY_REUSED, or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: this account spent its Agent notes write budget (10 writes per hour across all jobs, shared by the web and API surfaces); retry after details.retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/table": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Describe the job People table for this key",
        "description": "Requires `people_table:read`, a claimed account, the `people_table` agent surface and employer access to the job (`people_table.describe`). Every column with its exposure for this key, capabilities and operators; the limits and read budgets; the views (no config); the stage summary over eligible people (banned, closed and non-visible candidates are withheld everywhere). Contact, financial and compliance columns are redacted for API keys; Project To-do columns also need `project_todos:read` and Screening `lms:read`; candidate-written text is scrubbed and selectable only. A redacted column reads exactly like an unknown one in every request. The response `ETag` is weak and covers every field except `freshness.asOf`: the title, views, capabilities, stage counts and columns. `If-None-Match` with it answers `304` while all of those are unchanged. `schemaEtag` in the body is narrower (columns, exposure and options only), is the tag rows responses carry, and is not a validator for this route.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Table description",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "job",
                    "schemaEtag",
                    "exposurePolicyVersion",
                    "columns",
                    "operators",
                    "limits",
                    "capabilities",
                    "views",
                    "defaults",
                    "stageSummary",
                    "freshness",
                    "examples"
                  ],
                  "properties": {
                    "job": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "title"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        }
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    },
                    "exposurePolicyVersion": {
                      "type": "integer"
                    },
                    "columns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "label",
                          "origin",
                          "group",
                          "exposure",
                          "redactionClass",
                          "access",
                          "filterType",
                          "customType",
                          "operators",
                          "capabilities",
                          "defaultVisible",
                          "readOnly",
                          "schemaVersion",
                          "position",
                          "version",
                          "options",
                          "settings",
                          "description"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "origin": {
                            "type": "string",
                            "enum": [
                              "BUILT_IN",
                              "PRESENTATION",
                              "SYSTEM_DOCUMENT",
                              "CUSTOM"
                            ]
                          },
                          "group": {
                            "type": "string",
                            "enum": [
                              "Profile",
                              "Proposal",
                              "Work",
                              "Assessment",
                              "Financial",
                              "Compliance",
                              "Project To-dos",
                              "Custom"
                            ]
                          },
                          "exposure": {
                            "type": "string",
                            "enum": [
                              "exposed",
                              "redacted",
                              "unavailable"
                            ]
                          },
                          "redactionClass": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "CONTACT",
                              "FINANCIAL",
                              "COMPLIANCE",
                              "SCOPE_REQUIRED",
                              null
                            ]
                          },
                          "access": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "full",
                              "projection_only",
                              "select_only",
                              null
                            ]
                          },
                          "filterType": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "text",
                              "number",
                              "select",
                              "multiselect",
                              "boolean",
                              "date",
                              null
                            ]
                          },
                          "customType": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "TEXT",
                              "LONG_TEXT",
                              "NUMBER",
                              "CURRENCY",
                              "PERCENT",
                              "DURATION",
                              "DATE",
                              "URL",
                              "EMAIL",
                              "CHECKBOX",
                              "SELECT",
                              "MULTI_SELECT",
                              "COUNTRY",
                              "STATUS",
                              "PERSON",
                              null
                            ]
                          },
                          "operators": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "contains",
                                "not_contains",
                                "starts_with",
                                "ends_with",
                                "is",
                                "is_not",
                                "is_any_of",
                                "is_none_of",
                                "has_any_of",
                                "has_all_of",
                                "has_none_of",
                                "eq",
                                "neq",
                                "gt",
                                "gte",
                                "lt",
                                "lte",
                                "between",
                                "not_between",
                                "is_before",
                                "is_after",
                                "is_on_or_before",
                                "is_on_or_after",
                                "empty",
                                "not_empty"
                              ]
                            }
                          },
                          "capabilities": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "selectable",
                              "searchable",
                              "filterable",
                              "sortable",
                              "facetable",
                              "editable"
                            ],
                            "properties": {
                              "selectable": {
                                "type": "boolean"
                              },
                              "searchable": {
                                "type": "boolean"
                              },
                              "filterable": {
                                "type": "boolean"
                              },
                              "sortable": {
                                "type": "boolean"
                              },
                              "facetable": {
                                "type": "boolean"
                              },
                              "editable": {
                                "type": "boolean"
                              }
                            }
                          },
                          "defaultVisible": {
                            "type": "boolean"
                          },
                          "readOnly": {
                            "type": "boolean"
                          },
                          "schemaVersion": {
                            "type": "integer"
                          },
                          "position": {
                            "type": "integer"
                          },
                          "version": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "options": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "id",
                                "label",
                                "color"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "color": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "settings": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "currencyCode": {
                                "type": "string"
                              },
                              "minimum": {
                                "type": "number"
                              },
                              "maximum": {
                                "type": "number"
                              },
                              "precision": {
                                "type": "number"
                              },
                              "durationUnit": {
                                "type": "string",
                                "enum": [
                                  "hours",
                                  "minutes"
                                ]
                              }
                            }
                          },
                          "description": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "operators": {
                      "type": "object",
                      "description": "Operators per filter type.",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "contains",
                            "not_contains",
                            "starts_with",
                            "ends_with",
                            "is",
                            "is_not",
                            "is_any_of",
                            "is_none_of",
                            "has_any_of",
                            "has_all_of",
                            "has_none_of",
                            "eq",
                            "neq",
                            "gt",
                            "gte",
                            "lt",
                            "lte",
                            "between",
                            "not_between",
                            "is_before",
                            "is_after",
                            "is_on_or_before",
                            "is_on_or_after",
                            "empty",
                            "not_empty"
                          ]
                        }
                      },
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "text",
                          "number",
                          "select",
                          "multiselect",
                          "boolean",
                          "date"
                        ]
                      }
                    },
                    "limits": {
                      "type": "object",
                      "additionalProperties": false,
                      "description": "Page, sort, facet, projection, search and filter bounds, the cell batch and custom-column bounds, and the read and write budgets.",
                      "required": [
                        "pageDefault",
                        "pageMax",
                        "maxSorts",
                        "maxFacets",
                        "maxSelectedColumns",
                        "searchMaxChars",
                        "filter",
                        "cellBatch",
                        "column",
                        "view",
                        "changes",
                        "exportRowBudget",
                        "customColumnsMaxPerJob",
                        "writeBodyMaxBytes",
                        "readsInFlightPerKey",
                        "readStatementTimeoutMs",
                        "rateLimits"
                      ],
                      "properties": {
                        "pageDefault": {
                          "type": "integer"
                        },
                        "pageMax": {
                          "type": "integer"
                        },
                        "maxSorts": {
                          "type": "integer"
                        },
                        "maxFacets": {
                          "type": "integer"
                        },
                        "maxSelectedColumns": {
                          "type": "integer"
                        },
                        "searchMaxChars": {
                          "type": "integer"
                        },
                        "filter": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "maxDepth",
                            "maxRules",
                            "maxListValues",
                            "maxStringLength"
                          ],
                          "properties": {
                            "maxDepth": {
                              "type": "integer"
                            },
                            "maxRules": {
                              "type": "integer"
                            },
                            "maxListValues": {
                              "type": "integer"
                            },
                            "maxStringLength": {
                              "type": "integer"
                            }
                          }
                        },
                        "cellBatch": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "minEdits",
                            "maxEdits"
                          ],
                          "properties": {
                            "minEdits": {
                              "type": "integer"
                            },
                            "maxEdits": {
                              "type": "integer"
                            }
                          }
                        },
                        "column": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "nameMaxLength",
                            "minOptions",
                            "maxOptions",
                            "optionMaxLength"
                          ],
                          "properties": {
                            "nameMaxLength": {
                              "type": "integer"
                            },
                            "minOptions": {
                              "type": "integer"
                            },
                            "maxOptions": {
                              "type": "integer"
                            },
                            "optionMaxLength": {
                              "type": "integer"
                            }
                          }
                        },
                        "view": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "nameMaxLength",
                            "columnWidthMin",
                            "columnWidthMax"
                          ],
                          "properties": {
                            "nameMaxLength": {
                              "type": "integer"
                            },
                            "columnWidthMin": {
                              "type": "integer"
                            },
                            "columnWidthMax": {
                              "type": "integer"
                            }
                          }
                        },
                        "changes": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "pageDefault",
                            "pageMax",
                            "settledHorizonSeconds",
                            "cursorMaxAgeDays"
                          ],
                          "properties": {
                            "pageDefault": {
                              "type": "integer"
                            },
                            "pageMax": {
                              "type": "integer"
                            },
                            "settledHorizonSeconds": {
                              "type": "integer"
                            },
                            "cursorMaxAgeDays": {
                              "type": "integer"
                            }
                          }
                        },
                        "exportRowBudget": {
                          "type": "integer"
                        },
                        "customColumnsMaxPerJob": {
                          "type": "integer"
                        },
                        "writeBodyMaxBytes": {
                          "type": "integer"
                        },
                        "readsInFlightPerKey": {
                          "type": "integer"
                        },
                        "readStatementTimeoutMs": {
                          "type": "integer"
                        },
                        "rateLimits": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "readRequestsPerMinute",
                            "readRowsPerHour",
                            "writeRequestsPerMinute",
                            "writeEditsPerHour"
                          ],
                          "properties": {
                            "readRequestsPerMinute": {
                              "type": "integer"
                            },
                            "readRowsPerHour": {
                              "type": "integer"
                            },
                            "writeRequestsPerMinute": {
                              "type": "integer"
                            },
                            "writeEditsPerHour": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "capabilities": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "canWrite",
                        "agentNotes",
                        "projectTodoColumns",
                        "screeningColumn"
                      ],
                      "properties": {
                        "canWrite": {
                          "type": "boolean"
                        },
                        "agentNotes": {
                          "type": "boolean",
                          "description": "The Agent notes operations serve this key on this table: reads with people_table:read, writes when canWrite."
                        },
                        "projectTodoColumns": {
                          "type": "boolean",
                          "description": "The key holds project_todos:read."
                        },
                        "screeningColumn": {
                          "type": "boolean",
                          "description": "The key holds lms:read."
                        }
                      }
                    },
                    "views": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "name",
                          "scope",
                          "version"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "BUILT_IN",
                              "PERSONAL",
                              "ORGANIZATION"
                            ]
                          },
                          "version": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "defaults": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "personalDefaultViewId",
                        "jobDefaultViewId",
                        "lastOpenedViewId",
                        "resolvedViewId"
                      ],
                      "description": "Stored view preferences and the job default; each id names a view in views, or is null. resolvedViewId is the view a rows query without viewId applies.",
                      "properties": {
                        "personalDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "jobDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lastOpenedViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "resolvedViewId": {
                          "type": "string"
                        }
                      }
                    },
                    "stageSummary": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "stage",
                          "count"
                        ],
                        "properties": {
                          "stage": {
                            "type": "string",
                            "enum": [
                              "Invited",
                              "Applicant",
                              "Shortlisted",
                              "Hired",
                              "Former",
                              "Declined"
                            ]
                          },
                          "count": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "freshness": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "asOf",
                        "consistency"
                      ],
                      "properties": {
                        "asOf": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "consistency": {
                          "type": "string",
                          "enum": [
                            "live"
                          ]
                        }
                      }
                    },
                    "examples": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "title",
                          "request"
                        ],
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "request": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "search": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 200
                              },
                              "filter": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "type",
                                      "combinator",
                                      "rules"
                                    ],
                                    "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": [
                                          "group"
                                        ]
                                      },
                                      "combinator": {
                                        "type": "string",
                                        "enum": [
                                          "and",
                                          "or"
                                        ]
                                      },
                                      "rules": {
                                        "type": "array",
                                        "maxItems": 64,
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "type",
                                                "columnId",
                                                "operator"
                                              ],
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "rule"
                                                  ]
                                                },
                                                "columnId": {
                                                  "type": "string",
                                                  "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                },
                                                "operator": {
                                                  "type": "string",
                                                  "enum": [
                                                    "contains",
                                                    "not_contains",
                                                    "starts_with",
                                                    "ends_with",
                                                    "is",
                                                    "is_not",
                                                    "is_any_of",
                                                    "is_none_of",
                                                    "has_any_of",
                                                    "has_all_of",
                                                    "has_none_of",
                                                    "eq",
                                                    "neq",
                                                    "gt",
                                                    "gte",
                                                    "lt",
                                                    "lte",
                                                    "between",
                                                    "not_between",
                                                    "is_before",
                                                    "is_after",
                                                    "is_on_or_before",
                                                    "is_on_or_after",
                                                    "empty",
                                                    "not_empty"
                                                  ]
                                                },
                                                "value": {
                                                  "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                },
                                                "id": {
                                                  "type": "string",
                                                  "maxLength": 100
                                                }
                                              }
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "type",
                                                "combinator",
                                                "rules"
                                              ],
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "group"
                                                  ]
                                                },
                                                "combinator": {
                                                  "type": "string",
                                                  "enum": [
                                                    "and",
                                                    "or"
                                                  ]
                                                },
                                                "rules": {
                                                  "type": "array",
                                                  "maxItems": 64,
                                                  "items": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "type",
                                                          "columnId",
                                                          "operator"
                                                        ],
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "enum": [
                                                              "rule"
                                                            ]
                                                          },
                                                          "columnId": {
                                                            "type": "string",
                                                            "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                          },
                                                          "operator": {
                                                            "type": "string",
                                                            "enum": [
                                                              "contains",
                                                              "not_contains",
                                                              "starts_with",
                                                              "ends_with",
                                                              "is",
                                                              "is_not",
                                                              "is_any_of",
                                                              "is_none_of",
                                                              "has_any_of",
                                                              "has_all_of",
                                                              "has_none_of",
                                                              "eq",
                                                              "neq",
                                                              "gt",
                                                              "gte",
                                                              "lt",
                                                              "lte",
                                                              "between",
                                                              "not_between",
                                                              "is_before",
                                                              "is_after",
                                                              "is_on_or_before",
                                                              "is_on_or_after",
                                                              "empty",
                                                              "not_empty"
                                                            ]
                                                          },
                                                          "value": {
                                                            "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                          },
                                                          "id": {
                                                            "type": "string",
                                                            "maxLength": 100
                                                          }
                                                        }
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "type",
                                                          "combinator",
                                                          "rules"
                                                        ],
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "enum": [
                                                              "group"
                                                            ]
                                                          },
                                                          "combinator": {
                                                            "type": "string",
                                                            "enum": [
                                                              "and",
                                                              "or"
                                                            ]
                                                          },
                                                          "rules": {
                                                            "type": "array",
                                                            "maxItems": 64,
                                                            "items": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "additionalProperties": false,
                                                                  "required": [
                                                                    "type",
                                                                    "columnId",
                                                                    "operator"
                                                                  ],
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "rule"
                                                                      ]
                                                                    },
                                                                    "columnId": {
                                                                      "type": "string",
                                                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                    },
                                                                    "operator": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "contains",
                                                                        "not_contains",
                                                                        "starts_with",
                                                                        "ends_with",
                                                                        "is",
                                                                        "is_not",
                                                                        "is_any_of",
                                                                        "is_none_of",
                                                                        "has_any_of",
                                                                        "has_all_of",
                                                                        "has_none_of",
                                                                        "eq",
                                                                        "neq",
                                                                        "gt",
                                                                        "gte",
                                                                        "lt",
                                                                        "lte",
                                                                        "between",
                                                                        "not_between",
                                                                        "is_before",
                                                                        "is_after",
                                                                        "is_on_or_before",
                                                                        "is_on_or_after",
                                                                        "empty",
                                                                        "not_empty"
                                                                      ]
                                                                    },
                                                                    "value": {
                                                                      "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                    },
                                                                    "id": {
                                                                      "type": "string",
                                                                      "maxLength": 100
                                                                    }
                                                                  }
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "additionalProperties": false,
                                                                  "required": [
                                                                    "type",
                                                                    "combinator",
                                                                    "rules"
                                                                  ],
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "group"
                                                                      ]
                                                                    },
                                                                    "combinator": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "and",
                                                                        "or"
                                                                      ]
                                                                    },
                                                                    "rules": {
                                                                      "type": "array",
                                                                      "maxItems": 64,
                                                                      "items": {
                                                                        "oneOf": [
                                                                          {
                                                                            "type": "object",
                                                                            "additionalProperties": false,
                                                                            "required": [
                                                                              "type",
                                                                              "columnId",
                                                                              "operator"
                                                                            ],
                                                                            "properties": {
                                                                              "type": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "rule"
                                                                                ]
                                                                              },
                                                                              "columnId": {
                                                                                "type": "string",
                                                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                              },
                                                                              "operator": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "contains",
                                                                                  "not_contains",
                                                                                  "starts_with",
                                                                                  "ends_with",
                                                                                  "is",
                                                                                  "is_not",
                                                                                  "is_any_of",
                                                                                  "is_none_of",
                                                                                  "has_any_of",
                                                                                  "has_all_of",
                                                                                  "has_none_of",
                                                                                  "eq",
                                                                                  "neq",
                                                                                  "gt",
                                                                                  "gte",
                                                                                  "lt",
                                                                                  "lte",
                                                                                  "between",
                                                                                  "not_between",
                                                                                  "is_before",
                                                                                  "is_after",
                                                                                  "is_on_or_before",
                                                                                  "is_on_or_after",
                                                                                  "empty",
                                                                                  "not_empty"
                                                                                ]
                                                                              },
                                                                              "value": {
                                                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                              },
                                                                              "id": {
                                                                                "type": "string",
                                                                                "maxLength": 100
                                                                              }
                                                                            }
                                                                          },
                                                                          {
                                                                            "type": "object",
                                                                            "additionalProperties": false,
                                                                            "required": [
                                                                              "type",
                                                                              "combinator",
                                                                              "rules"
                                                                            ],
                                                                            "properties": {
                                                                              "type": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "group"
                                                                                ]
                                                                              },
                                                                              "combinator": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "and",
                                                                                  "or"
                                                                                ]
                                                                              },
                                                                              "rules": {
                                                                                "type": "array",
                                                                                "maxItems": 0
                                                                              },
                                                                              "id": {
                                                                                "type": "string",
                                                                                "maxLength": 100
                                                                              }
                                                                            }
                                                                          }
                                                                        ]
                                                                      }
                                                                    },
                                                                    "id": {
                                                                      "type": "string",
                                                                      "maxLength": 100
                                                                    }
                                                                  }
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "id": {
                                                            "type": "string",
                                                            "maxLength": 100
                                                          }
                                                        }
                                                      }
                                                    ]
                                                  }
                                                },
                                                "id": {
                                                  "type": "string",
                                                  "maxLength": 100
                                                }
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      "id": {
                                        "type": "string",
                                        "maxLength": 100
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "columns": {
                                "type": "array",
                                "maxItems": 64,
                                "items": {
                                  "type": "string",
                                  "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                },
                                "description": "Projection; default = the applied view's (or the table's) visible exposed columns."
                              },
                              "sort": {
                                "type": "array",
                                "maxItems": 5,
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "columnId",
                                    "direction"
                                  ],
                                  "properties": {
                                    "columnId": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    },
                                    "direction": {
                                      "type": "string",
                                      "enum": [
                                        "asc",
                                        "desc"
                                      ]
                                    }
                                  }
                                }
                              },
                              "viewId": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "maxLength": 128,
                                "pattern": "^[!-~]+$",
                                "description": "Omitted or null: the describe defaults.resolvedViewId view (personal default, else job default, else All People)."
                              },
                              "facets": {
                                "type": "array",
                                "maxItems": 10,
                                "items": {
                                  "type": "string",
                                  "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                }
                              },
                              "timeZone": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64,
                                "description": "IANA; default UTC."
                              },
                              "strict": {
                                "type": "boolean",
                                "description": "Default true: a non-queryable column refuses the request (COLUMN_NOT_QUERYABLE). With false the term is dropped and listed in diagnostics, unless dropping it would leave an OR group (in the filter or the applied view) with no terms; that is refused in both modes (COLUMN_NOT_QUERYABLE or VIEW_NOT_APPLICABLE)."
                              },
                              "includeTotal": {
                                "type": "boolean"
                              },
                              "limit": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 200
                              },
                              "cursor": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "maxLength": 32768,
                                "description": "page.nextCursor from the previous page, with the same query and key."
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "304": {
            "description": "Not modified: nothing in the description but freshness.asOf has changed since the response that carried this ETag"
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Read budget spent, two People table reads already in flight for this key, or the server at its People table read capacity (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "READ_TIMEOUT: the read passed its database bound (10 s a statement, 15 s in all); narrow the request or retry after Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/rows/query": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Query one keyset page of the job People table",
        "description": "Requires `people_table:read` and employer access to the job (`people_table.rows.query`). Search, a filter AST over column ids, up to five sorts (jobPersonId breaks ties), projection, facets and an optional saved view, over exposed columns and eligible people only. A column that is unknown, redacted, unavailable or lacks the capability is one `400` COLUMN_NOT_QUERYABLE in strict mode (the default) echoing only the ids sent, or a diagnostic with `strict: false`. A malformed rule is `400` INVALID_FILTER in both modes. The cursor binds the query, the key and its exposure set; the server mints `asOf` on page one. Each page charges its `limit` against the hourly row budget before it runs.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "search": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "filter": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "type",
                          "combinator",
                          "rules"
                        ],
                        "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "group"
                            ]
                          },
                          "combinator": {
                            "type": "string",
                            "enum": [
                              "and",
                              "or"
                            ]
                          },
                          "rules": {
                            "type": "array",
                            "maxItems": 64,
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "type",
                                    "columnId",
                                    "operator"
                                  ],
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "rule"
                                      ]
                                    },
                                    "columnId": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    },
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "contains",
                                        "not_contains",
                                        "starts_with",
                                        "ends_with",
                                        "is",
                                        "is_not",
                                        "is_any_of",
                                        "is_none_of",
                                        "has_any_of",
                                        "has_all_of",
                                        "has_none_of",
                                        "eq",
                                        "neq",
                                        "gt",
                                        "gte",
                                        "lt",
                                        "lte",
                                        "between",
                                        "not_between",
                                        "is_before",
                                        "is_after",
                                        "is_on_or_before",
                                        "is_on_or_after",
                                        "empty",
                                        "not_empty"
                                      ]
                                    },
                                    "value": {
                                      "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                    },
                                    "id": {
                                      "type": "string",
                                      "maxLength": 100
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "type",
                                    "combinator",
                                    "rules"
                                  ],
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "group"
                                      ]
                                    },
                                    "combinator": {
                                      "type": "string",
                                      "enum": [
                                        "and",
                                        "or"
                                      ]
                                    },
                                    "rules": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "columnId",
                                              "operator"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "rule"
                                                ]
                                              },
                                              "columnId": {
                                                "type": "string",
                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                              },
                                              "operator": {
                                                "type": "string",
                                                "enum": [
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "is",
                                                  "is_not",
                                                  "is_any_of",
                                                  "is_none_of",
                                                  "has_any_of",
                                                  "has_all_of",
                                                  "has_none_of",
                                                  "eq",
                                                  "neq",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "between",
                                                  "not_between",
                                                  "is_before",
                                                  "is_after",
                                                  "is_on_or_before",
                                                  "is_on_or_after",
                                                  "empty",
                                                  "not_empty"
                                                ]
                                              },
                                              "value": {
                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                              },
                                              "id": {
                                                "type": "string",
                                                "maxLength": 100
                                              }
                                            }
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "combinator",
                                              "rules"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "group"
                                                ]
                                              },
                                              "combinator": {
                                                "type": "string",
                                                "enum": [
                                                  "and",
                                                  "or"
                                                ]
                                              },
                                              "rules": {
                                                "type": "array",
                                                "maxItems": 64,
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "columnId",
                                                        "operator"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "rule"
                                                          ]
                                                        },
                                                        "columnId": {
                                                          "type": "string",
                                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                        },
                                                        "operator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "contains",
                                                            "not_contains",
                                                            "starts_with",
                                                            "ends_with",
                                                            "is",
                                                            "is_not",
                                                            "is_any_of",
                                                            "is_none_of",
                                                            "has_any_of",
                                                            "has_all_of",
                                                            "has_none_of",
                                                            "eq",
                                                            "neq",
                                                            "gt",
                                                            "gte",
                                                            "lt",
                                                            "lte",
                                                            "between",
                                                            "not_between",
                                                            "is_before",
                                                            "is_after",
                                                            "is_on_or_before",
                                                            "is_on_or_after",
                                                            "empty",
                                                            "not_empty"
                                                          ]
                                                        },
                                                        "value": {
                                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "maxLength": 100
                                                        }
                                                      }
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "combinator",
                                                        "rules"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "group"
                                                          ]
                                                        },
                                                        "combinator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "and",
                                                            "or"
                                                          ]
                                                        },
                                                        "rules": {
                                                          "type": "array",
                                                          "maxItems": 64,
                                                          "items": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "columnId",
                                                                  "operator"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "rule"
                                                                    ]
                                                                  },
                                                                  "columnId": {
                                                                    "type": "string",
                                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                  },
                                                                  "operator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "contains",
                                                                      "not_contains",
                                                                      "starts_with",
                                                                      "ends_with",
                                                                      "is",
                                                                      "is_not",
                                                                      "is_any_of",
                                                                      "is_none_of",
                                                                      "has_any_of",
                                                                      "has_all_of",
                                                                      "has_none_of",
                                                                      "eq",
                                                                      "neq",
                                                                      "gt",
                                                                      "gte",
                                                                      "lt",
                                                                      "lte",
                                                                      "between",
                                                                      "not_between",
                                                                      "is_before",
                                                                      "is_after",
                                                                      "is_on_or_before",
                                                                      "is_on_or_after",
                                                                      "empty",
                                                                      "not_empty"
                                                                    ]
                                                                  },
                                                                  "value": {
                                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "maxLength": 100
                                                                  }
                                                                }
                                                              },
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "combinator",
                                                                  "rules"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "group"
                                                                    ]
                                                                  },
                                                                  "combinator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "and",
                                                                      "or"
                                                                    ]
                                                                  },
                                                                  "rules": {
                                                                    "type": "array",
                                                                    "maxItems": 0
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "maxLength": 100
                                                                  }
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "maxLength": 100
                                                        }
                                                      }
                                                    }
                                                  ]
                                                }
                                              },
                                              "id": {
                                                "type": "string",
                                                "maxLength": 100
                                              }
                                            }
                                          }
                                        ]
                                      }
                                    },
                                    "id": {
                                      "type": "string",
                                      "maxLength": 100
                                    }
                                  }
                                }
                              ]
                            }
                          },
                          "id": {
                            "type": "string",
                            "maxLength": 100
                          }
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "columns": {
                    "type": "array",
                    "maxItems": 64,
                    "items": {
                      "type": "string",
                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                    },
                    "description": "Projection; default = the applied view's (or the table's) visible exposed columns."
                  },
                  "sort": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "columnId",
                        "direction"
                      ],
                      "properties": {
                        "columnId": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "asc",
                            "desc"
                          ]
                        }
                      }
                    }
                  },
                  "viewId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[!-~]+$",
                    "description": "Omitted or null: the describe defaults.resolvedViewId view (personal default, else job default, else All People)."
                  },
                  "facets": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                    }
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "IANA; default UTC."
                  },
                  "strict": {
                    "type": "boolean",
                    "description": "Default true: a non-queryable column refuses the request (COLUMN_NOT_QUERYABLE). With false the term is dropped and listed in diagnostics, unless dropping it would leave an OR group (in the filter or the applied view) with no terms; that is refused in both modes (COLUMN_NOT_QUERYABLE or VIEW_NOT_APPLICABLE)."
                  },
                  "includeTotal": {
                    "type": "boolean"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200
                  },
                  "cursor": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 32768,
                    "description": "page.nextCursor from the previous page, with the same query and key."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One page of rows",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "rows",
                    "columns",
                    "page",
                    "total",
                    "facets",
                    "asOf",
                    "timeZone",
                    "viewId",
                    "schemaEtag",
                    "diagnostics"
                  ],
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "jobPersonId",
                          "displayName",
                          "stage",
                          "proposalId",
                          "cells"
                        ],
                        "properties": {
                          "jobPersonId": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string",
                            "description": "The public name, \"First L.\", else \"Unnamed candidate\". Never searched, filtered, sorted or faceted."
                          },
                          "stage": {
                            "type": "string",
                            "enum": [
                              "Invited",
                              "Applicant",
                              "Shortlisted",
                              "Hired",
                              "Former",
                              "Declined"
                            ]
                          },
                          "proposalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "cells": {
                            "type": "object",
                            "description": "Keyed by the projected exposed column ids only.",
                            "additionalProperties": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "state",
                                    "value",
                                    "version"
                                  ],
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "value"
                                      ]
                                    },
                                    "value": {
                                      "description": "A string, number, boolean, string list, or null; {jobPersonId, displayName} for PERSON; the closed Screening ({state, …}) and Agent notes ({state, version, updatedAt, preview}) projections.",
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array",
                                          "items": {
                                            "type": "string"
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "jobPersonId",
                                            "displayName"
                                          ],
                                          "properties": {
                                            "jobPersonId": {
                                              "type": "string"
                                            },
                                            "displayName": {
                                              "type": "string"
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "state"
                                          ],
                                          "properties": {
                                            "state": {
                                              "type": "string",
                                              "enum": [
                                                "NONE"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "state",
                                            "reason"
                                          ],
                                          "properties": {
                                            "state": {
                                              "type": "string",
                                              "enum": [
                                                "UNKNOWN"
                                              ]
                                            },
                                            "reason": {
                                              "type": "string",
                                              "enum": [
                                                "NOT_READ",
                                                "READ_FAILED"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "state",
                                            "enrollmentKey",
                                            "status",
                                            "waitingOn",
                                            "gradeState",
                                            "earnedPoints",
                                            "possiblePoints",
                                            "percentage",
                                            "passed",
                                            "submittedAt",
                                            "courseVersionNumber",
                                            "courseVersionCurrent"
                                          ],
                                          "properties": {
                                            "state": {
                                              "type": "string",
                                              "enum": [
                                                "ENROLLED"
                                              ]
                                            },
                                            "enrollmentKey": {
                                              "type": "string"
                                            },
                                            "status": {
                                              "type": "string",
                                              "enum": [
                                                "OPEN",
                                                "IN_PROGRESS",
                                                "SUBMITTED"
                                              ]
                                            },
                                            "waitingOn": {
                                              "type": "string",
                                              "enum": [
                                                "WORKER",
                                                "EMPLOYER",
                                                "NONE"
                                              ]
                                            },
                                            "gradeState": {
                                              "type": [
                                                "string",
                                                "null"
                                              ]
                                            },
                                            "earnedPoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "possiblePoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "percentage": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "passed": {
                                              "type": [
                                                "boolean",
                                                "null"
                                              ]
                                            },
                                            "submittedAt": {
                                              "type": [
                                                "string",
                                                "null"
                                              ]
                                            },
                                            "courseVersionNumber": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "courseVersionCurrent": {
                                              "type": [
                                                "boolean",
                                                "null"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "state",
                                            "version",
                                            "updatedAt",
                                            "preview"
                                          ],
                                          "properties": {
                                            "state": {
                                              "type": "string",
                                              "enum": [
                                                "ACTIVE",
                                                "ARCHIVED"
                                              ]
                                            },
                                            "version": {
                                              "type": "integer"
                                            },
                                            "updatedAt": {
                                              "type": "string"
                                            },
                                            "preview": {
                                              "type": [
                                                "string",
                                                "null"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "version": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "description": "Custom cells only."
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "state"
                                  ],
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "empty"
                                      ]
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "state"
                                  ],
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "never_set"
                                      ]
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "state",
                                    "version"
                                  ],
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "cleared"
                                      ]
                                    },
                                    "version": {
                                      "type": "integer"
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "state"
                                  ],
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "withheld"
                                      ]
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        }
                      }
                    },
                    "columns": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "page": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "limit",
                        "hasMore",
                        "nextCursor"
                      ],
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "total": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Eligible rows; null unless includeTotal."
                    },
                    "facets": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "value",
                            "label",
                            "count"
                          ],
                          "properties": {
                            "value": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "label": {
                              "type": "string"
                            },
                            "count": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "viewId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The view this page applied: the request's viewId, else the resolved default."
                    },
                    "schemaEtag": {
                      "type": "string"
                    },
                    "diagnostics": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "reason",
                          "location",
                          "columnId"
                        ],
                        "properties": {
                          "reason": {
                            "type": "string",
                            "enum": [
                              "COLUMN_NOT_QUERYABLE",
                              "VIEW_TERM_NOT_APPLICABLE"
                            ]
                          },
                          "location": {
                            "type": "string",
                            "enum": [
                              "columns",
                              "sort",
                              "facets",
                              "filter",
                              "view"
                            ]
                          },
                          "columnId": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, COLUMN_NOT_QUERYABLE, INVALID_FILTER, LIMIT_EXCEEDED, CURSOR_INVALID or VIEW_NOT_APPLICABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or view not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Read budget spent, two People table reads already in flight for this key, or the server at its People table read capacity (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "READ_TIMEOUT: the read passed its database bound (10 s a statement, 15 s in all); narrow the request or retry after Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/rows/{jobPersonId}": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Read one person’s row of the job People table",
        "description": "Requires `people_table:read` and employer access to the job (`people_table.rows.get`). Every exposed column unless `columns` names some (comma-separated column ids). A missing, foreign or withheld person is the same `404`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "jobPersonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "columns",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One row",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "row",
                    "columns",
                    "schemaEtag"
                  ],
                  "properties": {
                    "row": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "jobPersonId",
                        "displayName",
                        "stage",
                        "proposalId",
                        "cells"
                      ],
                      "properties": {
                        "jobPersonId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string",
                          "description": "The public name, \"First L.\", else \"Unnamed candidate\". Never searched, filtered, sorted or faceted."
                        },
                        "stage": {
                          "type": "string",
                          "enum": [
                            "Invited",
                            "Applicant",
                            "Shortlisted",
                            "Hired",
                            "Former",
                            "Declined"
                          ]
                        },
                        "proposalId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "cells": {
                          "type": "object",
                          "description": "Keyed by the projected exposed column ids only.",
                          "additionalProperties": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "state",
                                  "value",
                                  "version"
                                ],
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "value"
                                    ]
                                  },
                                  "value": {
                                    "description": "A string, number, boolean, string list, or null; {jobPersonId, displayName} for PERSON; the closed Screening ({state, …}) and Agent notes ({state, version, updatedAt, preview}) projections.",
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "jobPersonId",
                                          "displayName"
                                        ],
                                        "properties": {
                                          "jobPersonId": {
                                            "type": "string"
                                          },
                                          "displayName": {
                                            "type": "string"
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string",
                                            "enum": [
                                              "NONE"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "reason"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string",
                                            "enum": [
                                              "UNKNOWN"
                                            ]
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "NOT_READ",
                                              "READ_FAILED"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "enrollmentKey",
                                          "status",
                                          "waitingOn",
                                          "gradeState",
                                          "earnedPoints",
                                          "possiblePoints",
                                          "percentage",
                                          "passed",
                                          "submittedAt",
                                          "courseVersionNumber",
                                          "courseVersionCurrent"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string",
                                            "enum": [
                                              "ENROLLED"
                                            ]
                                          },
                                          "enrollmentKey": {
                                            "type": "string"
                                          },
                                          "status": {
                                            "type": "string",
                                            "enum": [
                                              "OPEN",
                                              "IN_PROGRESS",
                                              "SUBMITTED"
                                            ]
                                          },
                                          "waitingOn": {
                                            "type": "string",
                                            "enum": [
                                              "WORKER",
                                              "EMPLOYER",
                                              "NONE"
                                            ]
                                          },
                                          "gradeState": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "earnedPoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "possiblePoints": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "percentage": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "passed": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          },
                                          "submittedAt": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "courseVersionNumber": {
                                            "type": [
                                              "number",
                                              "null"
                                            ]
                                          },
                                          "courseVersionCurrent": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "state",
                                          "version",
                                          "updatedAt",
                                          "preview"
                                        ],
                                        "properties": {
                                          "state": {
                                            "type": "string",
                                            "enum": [
                                              "ACTIVE",
                                              "ARCHIVED"
                                            ]
                                          },
                                          "version": {
                                            "type": "integer"
                                          },
                                          "updatedAt": {
                                            "type": "string"
                                          },
                                          "preview": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "version": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "description": "Custom cells only."
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "state"
                                ],
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "empty"
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "state"
                                ],
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "never_set"
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "state",
                                  "version"
                                ],
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "cleared"
                                    ]
                                  },
                                  "version": {
                                    "type": "integer"
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "state"
                                ],
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "withheld"
                                    ]
                                  }
                                }
                              }
                            ]
                          }
                        }
                      }
                    },
                    "columns": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_QUERY or COLUMN_NOT_QUERYABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign and withheld ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Read budget spent, two People table reads already in flight for this key, or the server at its People table read capacity (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "READ_TIMEOUT: the read passed its database bound (10 s a statement, 15 s in all); narrow the request or retry after Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/columns": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "List the job People table columns for this key",
        "description": "Requires `people_table:read` and employer access to the job (`people_table.columns.list`). The same column descriptors, in the same order, as describe: exposure, capabilities, operators and custom-column versions (the `expectedVersion` for a column write). A custom column is editable only for a key with `people_table:write`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Columns",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "columns",
                    "schemaEtag"
                  ],
                  "properties": {
                    "columns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "label",
                          "origin",
                          "group",
                          "exposure",
                          "redactionClass",
                          "access",
                          "filterType",
                          "customType",
                          "operators",
                          "capabilities",
                          "defaultVisible",
                          "readOnly",
                          "schemaVersion",
                          "position",
                          "version",
                          "options",
                          "settings",
                          "description"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "origin": {
                            "type": "string",
                            "enum": [
                              "BUILT_IN",
                              "PRESENTATION",
                              "SYSTEM_DOCUMENT",
                              "CUSTOM"
                            ]
                          },
                          "group": {
                            "type": "string",
                            "enum": [
                              "Profile",
                              "Proposal",
                              "Work",
                              "Assessment",
                              "Financial",
                              "Compliance",
                              "Project To-dos",
                              "Custom"
                            ]
                          },
                          "exposure": {
                            "type": "string",
                            "enum": [
                              "exposed",
                              "redacted",
                              "unavailable"
                            ]
                          },
                          "redactionClass": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "CONTACT",
                              "FINANCIAL",
                              "COMPLIANCE",
                              "SCOPE_REQUIRED",
                              null
                            ]
                          },
                          "access": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "full",
                              "projection_only",
                              "select_only",
                              null
                            ]
                          },
                          "filterType": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "text",
                              "number",
                              "select",
                              "multiselect",
                              "boolean",
                              "date",
                              null
                            ]
                          },
                          "customType": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "TEXT",
                              "LONG_TEXT",
                              "NUMBER",
                              "CURRENCY",
                              "PERCENT",
                              "DURATION",
                              "DATE",
                              "URL",
                              "EMAIL",
                              "CHECKBOX",
                              "SELECT",
                              "MULTI_SELECT",
                              "COUNTRY",
                              "STATUS",
                              "PERSON",
                              null
                            ]
                          },
                          "operators": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "contains",
                                "not_contains",
                                "starts_with",
                                "ends_with",
                                "is",
                                "is_not",
                                "is_any_of",
                                "is_none_of",
                                "has_any_of",
                                "has_all_of",
                                "has_none_of",
                                "eq",
                                "neq",
                                "gt",
                                "gte",
                                "lt",
                                "lte",
                                "between",
                                "not_between",
                                "is_before",
                                "is_after",
                                "is_on_or_before",
                                "is_on_or_after",
                                "empty",
                                "not_empty"
                              ]
                            }
                          },
                          "capabilities": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "selectable",
                              "searchable",
                              "filterable",
                              "sortable",
                              "facetable",
                              "editable"
                            ],
                            "properties": {
                              "selectable": {
                                "type": "boolean"
                              },
                              "searchable": {
                                "type": "boolean"
                              },
                              "filterable": {
                                "type": "boolean"
                              },
                              "sortable": {
                                "type": "boolean"
                              },
                              "facetable": {
                                "type": "boolean"
                              },
                              "editable": {
                                "type": "boolean"
                              }
                            }
                          },
                          "defaultVisible": {
                            "type": "boolean"
                          },
                          "readOnly": {
                            "type": "boolean"
                          },
                          "schemaVersion": {
                            "type": "integer"
                          },
                          "position": {
                            "type": "integer"
                          },
                          "version": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "options": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "id",
                                "label",
                                "color"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "color": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "settings": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "currencyCode": {
                                "type": "string"
                              },
                              "minimum": {
                                "type": "number"
                              },
                              "maximum": {
                                "type": "number"
                              },
                              "precision": {
                                "type": "number"
                              },
                              "durationUnit": {
                                "type": "string",
                                "enum": [
                                  "hours",
                                  "minutes"
                                ]
                              }
                            }
                          },
                          "description": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Read budget spent, two People table reads already in flight for this key, or the server at its People table read capacity (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "READ_TIMEOUT: the read passed its database bound (10 s a statement, 15 s in all); narrow the request or retry after Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Create a custom column on the job People table",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.columns.create`). Any of the 15 custom types, through the web column rules: a 1–48 character name unique among live columns, 1–50 options of 1–80 characters for SELECT, MULTI_SELECT and STATUS, and the settings that apply to the type. A body outside the published bounds is `400` INVALID_BODY; a refusal by the column rules is `400` VALIDATION naming the field. A job holds at most 100 active custom columns (`limits.customColumnsMaxPerJob`; archived ones do not count); one more is `400` LIMIT_EXCEEDED. The audit event records actor kind AGENT and the receipt id as batch id. A replay of the same key and body answers `replayed: true` with the response the write committed (the column and `schemaEtag` as they were), even after a later rename or archive.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "type"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "pattern": "\\S",
                    "description": "1–48 characters with at least one that is not a space; trimmed, and unique among the job’s live columns, ignoring case."
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "TEXT",
                      "LONG_TEXT",
                      "NUMBER",
                      "CURRENCY",
                      "PERCENT",
                      "DURATION",
                      "DATE",
                      "URL",
                      "EMAIL",
                      "CHECKBOX",
                      "SELECT",
                      "MULTI_SELECT",
                      "COUNTRY",
                      "STATUS",
                      "PERSON"
                    ]
                  },
                  "options": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "\\S"
                    },
                    "description": "SELECT, MULTI_SELECT and STATUS only: 1–50 labels of 1–80 characters, each with at least one that is not a space; trimmed, and unique ignoring case."
                  },
                  "settings": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "CURRENCY: currencyCode, precision, minimum, maximum; NUMBER and PERCENT: precision, minimum, maximum; DURATION: durationUnit. Other keys for the type are refused.",
                    "properties": {
                      "currencyCode": {
                        "type": "string",
                        "maxLength": 8
                      },
                      "minimum": {
                        "type": "number"
                      },
                      "maximum": {
                        "type": "number"
                      },
                      "precision": {
                        "type": "integer"
                      },
                      "durationUnit": {
                        "type": "string",
                        "enum": [
                          "hours",
                          "minutes"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Column created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "column",
                    "schemaEtag",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "column": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "label",
                        "origin",
                        "group",
                        "exposure",
                        "redactionClass",
                        "access",
                        "filterType",
                        "customType",
                        "operators",
                        "capabilities",
                        "defaultVisible",
                        "readOnly",
                        "schemaVersion",
                        "position",
                        "version",
                        "options",
                        "settings",
                        "description"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "origin": {
                          "type": "string",
                          "enum": [
                            "BUILT_IN",
                            "PRESENTATION",
                            "SYSTEM_DOCUMENT",
                            "CUSTOM"
                          ]
                        },
                        "group": {
                          "type": "string",
                          "enum": [
                            "Profile",
                            "Proposal",
                            "Work",
                            "Assessment",
                            "Financial",
                            "Compliance",
                            "Project To-dos",
                            "Custom"
                          ]
                        },
                        "exposure": {
                          "type": "string",
                          "enum": [
                            "exposed",
                            "redacted",
                            "unavailable"
                          ]
                        },
                        "redactionClass": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "CONTACT",
                            "FINANCIAL",
                            "COMPLIANCE",
                            "SCOPE_REQUIRED",
                            null
                          ]
                        },
                        "access": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "full",
                            "projection_only",
                            "select_only",
                            null
                          ]
                        },
                        "filterType": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "text",
                            "number",
                            "select",
                            "multiselect",
                            "boolean",
                            "date",
                            null
                          ]
                        },
                        "customType": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "TEXT",
                            "LONG_TEXT",
                            "NUMBER",
                            "CURRENCY",
                            "PERCENT",
                            "DURATION",
                            "DATE",
                            "URL",
                            "EMAIL",
                            "CHECKBOX",
                            "SELECT",
                            "MULTI_SELECT",
                            "COUNTRY",
                            "STATUS",
                            "PERSON",
                            null
                          ]
                        },
                        "operators": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "contains",
                              "not_contains",
                              "starts_with",
                              "ends_with",
                              "is",
                              "is_not",
                              "is_any_of",
                              "is_none_of",
                              "has_any_of",
                              "has_all_of",
                              "has_none_of",
                              "eq",
                              "neq",
                              "gt",
                              "gte",
                              "lt",
                              "lte",
                              "between",
                              "not_between",
                              "is_before",
                              "is_after",
                              "is_on_or_before",
                              "is_on_or_after",
                              "empty",
                              "not_empty"
                            ]
                          }
                        },
                        "capabilities": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "selectable",
                            "searchable",
                            "filterable",
                            "sortable",
                            "facetable",
                            "editable"
                          ],
                          "properties": {
                            "selectable": {
                              "type": "boolean"
                            },
                            "searchable": {
                              "type": "boolean"
                            },
                            "filterable": {
                              "type": "boolean"
                            },
                            "sortable": {
                              "type": "boolean"
                            },
                            "facetable": {
                              "type": "boolean"
                            },
                            "editable": {
                              "type": "boolean"
                            }
                          }
                        },
                        "defaultVisible": {
                          "type": "boolean"
                        },
                        "readOnly": {
                          "type": "boolean"
                        },
                        "schemaVersion": {
                          "type": "integer"
                        },
                        "position": {
                          "type": "integer"
                        },
                        "version": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "options": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "label",
                              "color"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "color": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "settings": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "currencyCode": {
                              "type": "string"
                            },
                            "minimum": {
                              "type": "number"
                            },
                            "maximum": {
                              "type": "number"
                            },
                            "precision": {
                              "type": "number"
                            },
                            "durationUnit": {
                              "type": "string",
                              "enum": [
                                "hours",
                                "minutes"
                              ]
                            }
                          }
                        },
                        "description": {
                          "type": "string"
                        }
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, VALIDATION or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/columns/{columnId}": {
      "patch": {
        "tags": [
          "jobs"
        ],
        "summary": "Rename a custom column of the job People table",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.columns.update`). Renames the column at `expectedVersion` (options and settings are fixed at create time). A system column is `400` COLUMN_NOT_EDITABLE; a stale version is `409` VERSION_MISMATCH. A replay of the same key and body answers `replayed: true` with the response the rename committed, even after a later archive.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "columnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedVersion",
                  "name"
                ],
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "pattern": "\\S",
                    "description": "1–48 characters with at least one that is not a space; trimmed, and unique among the job’s live columns, ignoring case."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Column renamed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "column",
                    "schemaEtag",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "column": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "label",
                        "origin",
                        "group",
                        "exposure",
                        "redactionClass",
                        "access",
                        "filterType",
                        "customType",
                        "operators",
                        "capabilities",
                        "defaultVisible",
                        "readOnly",
                        "schemaVersion",
                        "position",
                        "version",
                        "options",
                        "settings",
                        "description"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "origin": {
                          "type": "string",
                          "enum": [
                            "BUILT_IN",
                            "PRESENTATION",
                            "SYSTEM_DOCUMENT",
                            "CUSTOM"
                          ]
                        },
                        "group": {
                          "type": "string",
                          "enum": [
                            "Profile",
                            "Proposal",
                            "Work",
                            "Assessment",
                            "Financial",
                            "Compliance",
                            "Project To-dos",
                            "Custom"
                          ]
                        },
                        "exposure": {
                          "type": "string",
                          "enum": [
                            "exposed",
                            "redacted",
                            "unavailable"
                          ]
                        },
                        "redactionClass": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "CONTACT",
                            "FINANCIAL",
                            "COMPLIANCE",
                            "SCOPE_REQUIRED",
                            null
                          ]
                        },
                        "access": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "full",
                            "projection_only",
                            "select_only",
                            null
                          ]
                        },
                        "filterType": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "text",
                            "number",
                            "select",
                            "multiselect",
                            "boolean",
                            "date",
                            null
                          ]
                        },
                        "customType": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "TEXT",
                            "LONG_TEXT",
                            "NUMBER",
                            "CURRENCY",
                            "PERCENT",
                            "DURATION",
                            "DATE",
                            "URL",
                            "EMAIL",
                            "CHECKBOX",
                            "SELECT",
                            "MULTI_SELECT",
                            "COUNTRY",
                            "STATUS",
                            "PERSON",
                            null
                          ]
                        },
                        "operators": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "contains",
                              "not_contains",
                              "starts_with",
                              "ends_with",
                              "is",
                              "is_not",
                              "is_any_of",
                              "is_none_of",
                              "has_any_of",
                              "has_all_of",
                              "has_none_of",
                              "eq",
                              "neq",
                              "gt",
                              "gte",
                              "lt",
                              "lte",
                              "between",
                              "not_between",
                              "is_before",
                              "is_after",
                              "is_on_or_before",
                              "is_on_or_after",
                              "empty",
                              "not_empty"
                            ]
                          }
                        },
                        "capabilities": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "selectable",
                            "searchable",
                            "filterable",
                            "sortable",
                            "facetable",
                            "editable"
                          ],
                          "properties": {
                            "selectable": {
                              "type": "boolean"
                            },
                            "searchable": {
                              "type": "boolean"
                            },
                            "filterable": {
                              "type": "boolean"
                            },
                            "sortable": {
                              "type": "boolean"
                            },
                            "facetable": {
                              "type": "boolean"
                            },
                            "editable": {
                              "type": "boolean"
                            }
                          }
                        },
                        "defaultVisible": {
                          "type": "boolean"
                        },
                        "readOnly": {
                          "type": "boolean"
                        },
                        "schemaVersion": {
                          "type": "integer"
                        },
                        "position": {
                          "type": "integer"
                        },
                        "version": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "options": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "label",
                              "color"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "color": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "settings": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "currencyCode": {
                              "type": "string"
                            },
                            "minimum": {
                              "type": "number"
                            },
                            "maximum": {
                              "type": "number"
                            },
                            "precision": {
                              "type": "number"
                            },
                            "durationUnit": {
                              "type": "string",
                              "enum": [
                                "hours",
                                "minutes"
                              ]
                            }
                          }
                        },
                        "description": {
                          "type": "string"
                        }
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, INVALID_PATH, VALIDATION or COLUMN_NOT_EDITABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or column not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH, IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/columns/{columnId}/archive": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Archive a custom column of the job People table (preview, then confirm)",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.columns.archive`). `dryRun: true` previews the impact (live values on eligible rows, and the views the caller can open that name the column) and writes nothing; it counts as a read. `confirm: true` archives at `expectedVersion` and needs `Idempotency-Key`. Neither is `400` CONFIRM_REQUIRED. The values are kept and the web can restore the column.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "columnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedVersion"
                ],
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "confirm": {
                    "type": "boolean",
                    "description": "Archive the column."
                  },
                  "dryRun": {
                    "type": "boolean",
                    "description": "Preview the impact; nothing is written."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview or archive",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "columnId",
                    "archived",
                    "version",
                    "impact",
                    "schemaEtag",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "columnId": {
                      "type": "string",
                      "pattern": "^custom:[A-Za-z0-9_-]{1,64}$"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "impact": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "valueCount",
                        "viewCount"
                      ],
                      "properties": {
                        "valueCount": {
                          "type": "integer",
                          "description": "Live values in the column on eligible rows only."
                        },
                        "viewCount": {
                          "type": "integer",
                          "description": "ORGANIZATION views and the caller’s own PERSONAL views that name the column."
                        }
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, INVALID_PATH, CONFIRM_REQUIRED, COLUMN_NOT_EDITABLE or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or column not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH, IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/cells": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Write 1–500 custom cells of the job People table",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.cells.batch`). Each edit names a row (`jobPersonId`), a custom column and `expectedVersion` (null only for a never_set cell; tombstones keep theirs). `atomic` (default) writes all or nothing in one transaction; `independent` commits each edit on its own, in order, and a same-key retry after a failure finishes only the edits that had not committed. One result per edit, in request order. A body over 4 MiB of UTF-8 (`limits.writeBodyMaxBytes`) is `400` LIMIT_EXCEEDED; split a large batch. For a large batch use `independent` with an `Idempotency-Key`: if the call is cut off (this route allows 300 s, hosted MCP 180 s), retry the same key to finish it. A row the caller cannot reach (unknown, another job, or a withheld person) is the opaque `404`. A system or unknown column is a per-edit COLUMN_NOT_EDITABLE; a PERSON value must name an eligible person on the job. `dryRun: true` checks columns, persons, values and versions, writes nothing, needs no key and counts as a read. Each edit is charged against the hourly edit budget before the write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "edits"
                ],
                "properties": {
                  "edits": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "jobPersonId",
                        "columnId",
                        "value",
                        "expectedVersion"
                      ],
                      "properties": {
                        "jobPersonId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[!-~]+$"
                        },
                        "columnId": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        },
                        "value": {
                          "description": "null clears the cell. TEXT, LONG_TEXT, URL, EMAIL, COUNTRY and DATE (YYYY-MM-DD): string; NUMBER and PERCENT: number; CURRENCY: decimal string or number; DURATION: whole seconds; CHECKBOX: boolean; SELECT and STATUS: an option label; MULTI_SELECT: option labels; PERSON: a jobPersonId on the same job.",
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 20480
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "array",
                              "maxItems": 50,
                              "items": {
                                "type": "string",
                                "maxLength": 200
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "expectedVersion": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "description": "Exactly the version read: null only for a never_set cell."
                        }
                      }
                    }
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "atomic",
                      "independent"
                    ]
                  },
                  "dryRun": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-edit results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "mode",
                    "applied",
                    "results",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "mode": {
                      "type": "string",
                      "enum": [
                        "atomic",
                        "independent"
                      ]
                    },
                    "applied": {
                      "type": "boolean"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "jobPersonId",
                              "columnId",
                              "status",
                              "version"
                            ],
                            "properties": {
                              "jobPersonId": {
                                "type": "string"
                              },
                              "columnId": {
                                "type": "string"
                              },
                              "status": {
                                "const": "applied"
                              },
                              "version": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "jobPersonId",
                              "columnId",
                              "status",
                              "reason",
                              "message"
                            ],
                            "properties": {
                              "jobPersonId": {
                                "type": "string"
                              },
                              "columnId": {
                                "type": "string"
                              },
                              "status": {
                                "const": "rejected"
                              },
                              "reason": {
                                "type": "string",
                                "enum": [
                                  "VALIDATION",
                                  "VERSION_MISMATCH",
                                  "UNIQUE",
                                  "COLUMN_NOT_EDITABLE"
                                ]
                              },
                              "message": {
                                "type": "string"
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "jobPersonId",
                              "columnId",
                              "status"
                            ],
                            "properties": {
                              "jobPersonId": {
                                "type": "string"
                              },
                              "columnId": {
                                "type": "string"
                              },
                              "status": {
                                "const": "not_applied"
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "jobPersonId",
                              "columnId",
                              "status"
                            ],
                            "properties": {
                              "jobPersonId": {
                                "type": "string"
                              },
                              "columnId": {
                                "type": "string"
                              },
                              "status": {
                                "const": "valid"
                              }
                            }
                          }
                        ]
                      }
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, LIMIT_EXCEEDED or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign and withheld ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/rows/{jobPersonId}/cells/{columnId}": {
      "put": {
        "tags": [
          "jobs"
        ],
        "summary": "Write or clear one custom cell of the job People table",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.cells.set`). One edit as a one-edit atomic batch: `value: null` clears the cell (a versioned tombstone). A rejection is `400` VALIDATION or COLUMN_NOT_EDITABLE, or `409` VERSION_MISMATCH.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "jobPersonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "columnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "value",
                  "expectedVersion"
                ],
                "properties": {
                  "value": {
                    "description": "null clears the cell. TEXT, LONG_TEXT, URL, EMAIL, COUNTRY and DATE (YYYY-MM-DD): string; NUMBER and PERCENT: number; CURRENCY: decimal string or number; DURATION: whole seconds; CHECKBOX: boolean; SELECT and STATUS: an option label; MULTI_SELECT: option labels; PERSON: a jobPersonId on the same job.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 20480
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "array",
                        "maxItems": 50,
                        "items": {
                          "type": "string",
                          "maxLength": 200
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expectedVersion": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "description": "Exactly the version read: null only for a never_set cell."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cell written",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobPersonId",
                    "columnId",
                    "version",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "jobPersonId": {
                      "type": "string"
                    },
                    "columnId": {
                      "type": "string"
                    },
                    "version": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, INVALID_PATH, VALIDATION, COLUMN_NOT_EDITABLE or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign and withheld ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH, IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/changes": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "List the job People table changes since a point",
        "description": "Requires `people_table:read` and employer access to the job (`people_table.changes.list`). Settled changes, oldest first: column, custom cell, view, own preference, job default and Agent-notes events. Each is projected as rows and views are: a cell change names the row by `jobPersonId`, a PERSON value is `{jobPersonId, displayName}` and reads as null when its target is withheld, a view config withholds rule values this key cannot query (I5), and Agent-notes events carry metadata only, never a body or preview. Changes about a withheld person, another member’s PERSONAL view or preferences, and cells of columns that are not live exposed custom columns are not listed; built-in columns have no events (re-query). Only changes older than `limits.changes.settledHorizonSeconds` are listed (`settledThrough`), so a slow write that commits later still arrives on a later page. `since` (first page only) starts the feed; every page returns a `nextCursor` to poll from, bound to the key, the job and the exposure set. There is no `304` on this feed. A page charges its `limit` against the row budget.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "changes",
                    "page",
                    "settledThrough",
                    "schemaEtag"
                  ],
                  "properties": {
                    "changes": {
                      "type": "array",
                      "maxItems": 200,
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "at",
                              "actor",
                              "batchId",
                              "kind",
                              "columnId",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actor": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "userId"
                                ],
                                "description": "An employer user, or an agent acting as one. No name or e-mail.",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "USER",
                                      "AGENT",
                                      "SYSTEM"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                }
                              },
                              "batchId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "column.created",
                                  "column.renamed",
                                  "column.archived"
                                ]
                              },
                              "columnId": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "name": {
                                "type": "string"
                              },
                              "previousName": {
                                "type": "string"
                              },
                              "customType": {
                                "type": "string",
                                "enum": [
                                  "TEXT",
                                  "LONG_TEXT",
                                  "NUMBER",
                                  "CURRENCY",
                                  "PERCENT",
                                  "DURATION",
                                  "DATE",
                                  "URL",
                                  "EMAIL",
                                  "CHECKBOX",
                                  "SELECT",
                                  "MULTI_SELECT",
                                  "COUNTRY",
                                  "STATUS",
                                  "PERSON"
                                ]
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "at",
                              "actor",
                              "batchId",
                              "kind",
                              "jobPersonId",
                              "columnId",
                              "before",
                              "after"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actor": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "userId"
                                ],
                                "description": "An employer user, or an agent acting as one. No name or e-mail.",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "USER",
                                      "AGENT",
                                      "SYSTEM"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                }
                              },
                              "batchId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "cell.updated",
                                  "cell.cleared"
                                ]
                              },
                              "jobPersonId": {
                                "type": "string"
                              },
                              "columnId": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "before": {
                                "description": "Null, or the value as a row cell reads it: a string, number, boolean, string list, or {jobPersonId, displayName} for PERSON (null when the target is withheld).",
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "jobPersonId",
                                      "displayName"
                                    ],
                                    "properties": {
                                      "jobPersonId": {
                                        "type": "string"
                                      },
                                      "displayName": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "after": {
                                "description": "Null, or the value as a row cell reads it: a string, number, boolean, string list, or {jobPersonId, displayName} for PERSON (null when the target is withheld).",
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "jobPersonId",
                                      "displayName"
                                    ],
                                    "properties": {
                                      "jobPersonId": {
                                        "type": "string"
                                      },
                                      "displayName": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "at",
                              "actor",
                              "batchId",
                              "kind",
                              "viewId",
                              "scope",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actor": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "userId"
                                ],
                                "description": "An employer user, or an agent acting as one. No name or e-mail.",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "USER",
                                      "AGENT",
                                      "SYSTEM"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                }
                              },
                              "batchId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "view.created",
                                  "view.updated",
                                  "view.archived",
                                  "view.restored"
                                ]
                              },
                              "viewId": {
                                "type": "string"
                              },
                              "scope": {
                                "type": "string",
                                "enum": [
                                  "PERSONAL",
                                  "ORGANIZATION"
                                ]
                              },
                              "name": {
                                "type": "string"
                              },
                              "previousName": {
                                "type": "string"
                              },
                              "config": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "columnOrder",
                                  "columnVisibility",
                                  "columnPinning",
                                  "columnSizing",
                                  "sort",
                                  "filter",
                                  "density"
                                ],
                                "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                                "properties": {
                                  "columnOrder": {
                                    "type": "array",
                                    "maxItems": 256,
                                    "items": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    }
                                  },
                                  "columnVisibility": {
                                    "type": "object",
                                    "maxProperties": 256,
                                    "propertyNames": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    },
                                    "additionalProperties": {
                                      "type": "boolean"
                                    }
                                  },
                                  "columnPinning": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "start",
                                      "end"
                                    ],
                                    "properties": {
                                      "start": {
                                        "type": "array",
                                        "maxItems": 256,
                                        "items": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        }
                                      },
                                      "end": {
                                        "type": "array",
                                        "maxItems": 256,
                                        "items": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        }
                                      }
                                    }
                                  },
                                  "columnSizing": {
                                    "type": "object",
                                    "maxProperties": 256,
                                    "propertyNames": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    },
                                    "additionalProperties": {
                                      "type": "integer",
                                      "minimum": 72,
                                      "maximum": 800
                                    }
                                  },
                                  "sort": {
                                    "type": "array",
                                    "maxItems": 5,
                                    "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "columnId",
                                        "direction"
                                      ],
                                      "properties": {
                                        "columnId": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        },
                                        "direction": {
                                          "type": "string",
                                          "enum": [
                                            "asc",
                                            "desc"
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "filter": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "type",
                                          "combinator",
                                          "rules"
                                        ],
                                        "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "group"
                                            ]
                                          },
                                          "combinator": {
                                            "type": "string",
                                            "enum": [
                                              "and",
                                              "or"
                                            ]
                                          },
                                          "rules": {
                                            "type": "array",
                                            "maxItems": 64,
                                            "items": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "type",
                                                    "columnId",
                                                    "operator"
                                                  ],
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "enum": [
                                                        "rule"
                                                      ]
                                                    },
                                                    "columnId": {
                                                      "type": "string",
                                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                    },
                                                    "operator": {
                                                      "type": "string",
                                                      "enum": [
                                                        "contains",
                                                        "not_contains",
                                                        "starts_with",
                                                        "ends_with",
                                                        "is",
                                                        "is_not",
                                                        "is_any_of",
                                                        "is_none_of",
                                                        "has_any_of",
                                                        "has_all_of",
                                                        "has_none_of",
                                                        "eq",
                                                        "neq",
                                                        "gt",
                                                        "gte",
                                                        "lt",
                                                        "lte",
                                                        "between",
                                                        "not_between",
                                                        "is_before",
                                                        "is_after",
                                                        "is_on_or_before",
                                                        "is_on_or_after",
                                                        "empty",
                                                        "not_empty"
                                                      ]
                                                    },
                                                    "value": {
                                                      "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                    },
                                                    "id": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 100
                                                    },
                                                    "negated": {
                                                      "type": "boolean",
                                                      "enum": [
                                                        true
                                                      ],
                                                      "description": "The rule matches the rows its condition does not."
                                                    },
                                                    "withheld": {
                                                      "type": "boolean",
                                                      "enum": [
                                                        true
                                                      ],
                                                      "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                    }
                                                  }
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "type",
                                                    "combinator",
                                                    "rules"
                                                  ],
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "enum": [
                                                        "group"
                                                      ]
                                                    },
                                                    "combinator": {
                                                      "type": "string",
                                                      "enum": [
                                                        "and",
                                                        "or"
                                                      ]
                                                    },
                                                    "rules": {
                                                      "type": "array",
                                                      "maxItems": 64,
                                                      "items": {
                                                        "oneOf": [
                                                          {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "type",
                                                              "columnId",
                                                              "operator"
                                                            ],
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "rule"
                                                                ]
                                                              },
                                                              "columnId": {
                                                                "type": "string",
                                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                              },
                                                              "operator": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "contains",
                                                                  "not_contains",
                                                                  "starts_with",
                                                                  "ends_with",
                                                                  "is",
                                                                  "is_not",
                                                                  "is_any_of",
                                                                  "is_none_of",
                                                                  "has_any_of",
                                                                  "has_all_of",
                                                                  "has_none_of",
                                                                  "eq",
                                                                  "neq",
                                                                  "gt",
                                                                  "gte",
                                                                  "lt",
                                                                  "lte",
                                                                  "between",
                                                                  "not_between",
                                                                  "is_before",
                                                                  "is_after",
                                                                  "is_on_or_before",
                                                                  "is_on_or_after",
                                                                  "empty",
                                                                  "not_empty"
                                                                ]
                                                              },
                                                              "value": {
                                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                              },
                                                              "id": {
                                                                "type": "string",
                                                                "minLength": 1,
                                                                "maxLength": 100
                                                              },
                                                              "negated": {
                                                                "type": "boolean",
                                                                "enum": [
                                                                  true
                                                                ],
                                                                "description": "The rule matches the rows its condition does not."
                                                              },
                                                              "withheld": {
                                                                "type": "boolean",
                                                                "enum": [
                                                                  true
                                                                ],
                                                                "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                              }
                                                            }
                                                          },
                                                          {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "type",
                                                              "combinator",
                                                              "rules"
                                                            ],
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "group"
                                                                ]
                                                              },
                                                              "combinator": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "and",
                                                                  "or"
                                                                ]
                                                              },
                                                              "rules": {
                                                                "type": "array",
                                                                "maxItems": 64,
                                                                "items": {
                                                                  "oneOf": [
                                                                    {
                                                                      "type": "object",
                                                                      "additionalProperties": false,
                                                                      "required": [
                                                                        "type",
                                                                        "columnId",
                                                                        "operator"
                                                                      ],
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "rule"
                                                                          ]
                                                                        },
                                                                        "columnId": {
                                                                          "type": "string",
                                                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                        },
                                                                        "operator": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "contains",
                                                                            "not_contains",
                                                                            "starts_with",
                                                                            "ends_with",
                                                                            "is",
                                                                            "is_not",
                                                                            "is_any_of",
                                                                            "is_none_of",
                                                                            "has_any_of",
                                                                            "has_all_of",
                                                                            "has_none_of",
                                                                            "eq",
                                                                            "neq",
                                                                            "gt",
                                                                            "gte",
                                                                            "lt",
                                                                            "lte",
                                                                            "between",
                                                                            "not_between",
                                                                            "is_before",
                                                                            "is_after",
                                                                            "is_on_or_before",
                                                                            "is_on_or_after",
                                                                            "empty",
                                                                            "not_empty"
                                                                          ]
                                                                        },
                                                                        "value": {
                                                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                        },
                                                                        "id": {
                                                                          "type": "string",
                                                                          "minLength": 1,
                                                                          "maxLength": 100
                                                                        },
                                                                        "negated": {
                                                                          "type": "boolean",
                                                                          "enum": [
                                                                            true
                                                                          ],
                                                                          "description": "The rule matches the rows its condition does not."
                                                                        },
                                                                        "withheld": {
                                                                          "type": "boolean",
                                                                          "enum": [
                                                                            true
                                                                          ],
                                                                          "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                        }
                                                                      }
                                                                    },
                                                                    {
                                                                      "type": "object",
                                                                      "additionalProperties": false,
                                                                      "required": [
                                                                        "type",
                                                                        "combinator",
                                                                        "rules"
                                                                      ],
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "group"
                                                                          ]
                                                                        },
                                                                        "combinator": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "and",
                                                                            "or"
                                                                          ]
                                                                        },
                                                                        "rules": {
                                                                          "type": "array",
                                                                          "maxItems": 64,
                                                                          "items": {
                                                                            "oneOf": [
                                                                              {
                                                                                "type": "object",
                                                                                "additionalProperties": false,
                                                                                "required": [
                                                                                  "type",
                                                                                  "columnId",
                                                                                  "operator"
                                                                                ],
                                                                                "properties": {
                                                                                  "type": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "rule"
                                                                                    ]
                                                                                  },
                                                                                  "columnId": {
                                                                                    "type": "string",
                                                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                                  },
                                                                                  "operator": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "contains",
                                                                                      "not_contains",
                                                                                      "starts_with",
                                                                                      "ends_with",
                                                                                      "is",
                                                                                      "is_not",
                                                                                      "is_any_of",
                                                                                      "is_none_of",
                                                                                      "has_any_of",
                                                                                      "has_all_of",
                                                                                      "has_none_of",
                                                                                      "eq",
                                                                                      "neq",
                                                                                      "gt",
                                                                                      "gte",
                                                                                      "lt",
                                                                                      "lte",
                                                                                      "between",
                                                                                      "not_between",
                                                                                      "is_before",
                                                                                      "is_after",
                                                                                      "is_on_or_before",
                                                                                      "is_on_or_after",
                                                                                      "empty",
                                                                                      "not_empty"
                                                                                    ]
                                                                                  },
                                                                                  "value": {
                                                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                                  },
                                                                                  "id": {
                                                                                    "type": "string",
                                                                                    "minLength": 1,
                                                                                    "maxLength": 100
                                                                                  },
                                                                                  "negated": {
                                                                                    "type": "boolean",
                                                                                    "enum": [
                                                                                      true
                                                                                    ],
                                                                                    "description": "The rule matches the rows its condition does not."
                                                                                  },
                                                                                  "withheld": {
                                                                                    "type": "boolean",
                                                                                    "enum": [
                                                                                      true
                                                                                    ],
                                                                                    "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                                  }
                                                                                }
                                                                              },
                                                                              {
                                                                                "type": "object",
                                                                                "additionalProperties": false,
                                                                                "required": [
                                                                                  "type",
                                                                                  "combinator",
                                                                                  "rules"
                                                                                ],
                                                                                "properties": {
                                                                                  "type": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "group"
                                                                                    ]
                                                                                  },
                                                                                  "combinator": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "and",
                                                                                      "or"
                                                                                    ]
                                                                                  },
                                                                                  "rules": {
                                                                                    "type": "array",
                                                                                    "maxItems": 0
                                                                                  },
                                                                                  "id": {
                                                                                    "type": "string",
                                                                                    "minLength": 1,
                                                                                    "maxLength": 100
                                                                                  }
                                                                                }
                                                                              }
                                                                            ]
                                                                          }
                                                                        },
                                                                        "id": {
                                                                          "type": "string",
                                                                          "minLength": 1,
                                                                          "maxLength": 100
                                                                        }
                                                                      }
                                                                    }
                                                                  ]
                                                                }
                                                              },
                                                              "id": {
                                                                "type": "string",
                                                                "minLength": 1,
                                                                "maxLength": 100
                                                              }
                                                            }
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "id": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 100
                                                    }
                                                  }
                                                }
                                              ]
                                            }
                                          },
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 100
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "density": {
                                    "type": "string",
                                    "enum": [
                                      "compact",
                                      "comfortable"
                                    ]
                                  }
                                }
                              },
                              "previousConfig": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "columnOrder",
                                  "columnVisibility",
                                  "columnPinning",
                                  "columnSizing",
                                  "sort",
                                  "filter",
                                  "density"
                                ],
                                "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                                "properties": {
                                  "columnOrder": {
                                    "type": "array",
                                    "maxItems": 256,
                                    "items": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    }
                                  },
                                  "columnVisibility": {
                                    "type": "object",
                                    "maxProperties": 256,
                                    "propertyNames": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    },
                                    "additionalProperties": {
                                      "type": "boolean"
                                    }
                                  },
                                  "columnPinning": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "start",
                                      "end"
                                    ],
                                    "properties": {
                                      "start": {
                                        "type": "array",
                                        "maxItems": 256,
                                        "items": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        }
                                      },
                                      "end": {
                                        "type": "array",
                                        "maxItems": 256,
                                        "items": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        }
                                      }
                                    }
                                  },
                                  "columnSizing": {
                                    "type": "object",
                                    "maxProperties": 256,
                                    "propertyNames": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    },
                                    "additionalProperties": {
                                      "type": "integer",
                                      "minimum": 72,
                                      "maximum": 800
                                    }
                                  },
                                  "sort": {
                                    "type": "array",
                                    "maxItems": 5,
                                    "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                                    "items": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "columnId",
                                        "direction"
                                      ],
                                      "properties": {
                                        "columnId": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        },
                                        "direction": {
                                          "type": "string",
                                          "enum": [
                                            "asc",
                                            "desc"
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "filter": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "type",
                                          "combinator",
                                          "rules"
                                        ],
                                        "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "group"
                                            ]
                                          },
                                          "combinator": {
                                            "type": "string",
                                            "enum": [
                                              "and",
                                              "or"
                                            ]
                                          },
                                          "rules": {
                                            "type": "array",
                                            "maxItems": 64,
                                            "items": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "type",
                                                    "columnId",
                                                    "operator"
                                                  ],
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "enum": [
                                                        "rule"
                                                      ]
                                                    },
                                                    "columnId": {
                                                      "type": "string",
                                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                    },
                                                    "operator": {
                                                      "type": "string",
                                                      "enum": [
                                                        "contains",
                                                        "not_contains",
                                                        "starts_with",
                                                        "ends_with",
                                                        "is",
                                                        "is_not",
                                                        "is_any_of",
                                                        "is_none_of",
                                                        "has_any_of",
                                                        "has_all_of",
                                                        "has_none_of",
                                                        "eq",
                                                        "neq",
                                                        "gt",
                                                        "gte",
                                                        "lt",
                                                        "lte",
                                                        "between",
                                                        "not_between",
                                                        "is_before",
                                                        "is_after",
                                                        "is_on_or_before",
                                                        "is_on_or_after",
                                                        "empty",
                                                        "not_empty"
                                                      ]
                                                    },
                                                    "value": {
                                                      "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                    },
                                                    "id": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 100
                                                    },
                                                    "negated": {
                                                      "type": "boolean",
                                                      "enum": [
                                                        true
                                                      ],
                                                      "description": "The rule matches the rows its condition does not."
                                                    },
                                                    "withheld": {
                                                      "type": "boolean",
                                                      "enum": [
                                                        true
                                                      ],
                                                      "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                    }
                                                  }
                                                },
                                                {
                                                  "type": "object",
                                                  "additionalProperties": false,
                                                  "required": [
                                                    "type",
                                                    "combinator",
                                                    "rules"
                                                  ],
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "enum": [
                                                        "group"
                                                      ]
                                                    },
                                                    "combinator": {
                                                      "type": "string",
                                                      "enum": [
                                                        "and",
                                                        "or"
                                                      ]
                                                    },
                                                    "rules": {
                                                      "type": "array",
                                                      "maxItems": 64,
                                                      "items": {
                                                        "oneOf": [
                                                          {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "type",
                                                              "columnId",
                                                              "operator"
                                                            ],
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "rule"
                                                                ]
                                                              },
                                                              "columnId": {
                                                                "type": "string",
                                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                              },
                                                              "operator": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "contains",
                                                                  "not_contains",
                                                                  "starts_with",
                                                                  "ends_with",
                                                                  "is",
                                                                  "is_not",
                                                                  "is_any_of",
                                                                  "is_none_of",
                                                                  "has_any_of",
                                                                  "has_all_of",
                                                                  "has_none_of",
                                                                  "eq",
                                                                  "neq",
                                                                  "gt",
                                                                  "gte",
                                                                  "lt",
                                                                  "lte",
                                                                  "between",
                                                                  "not_between",
                                                                  "is_before",
                                                                  "is_after",
                                                                  "is_on_or_before",
                                                                  "is_on_or_after",
                                                                  "empty",
                                                                  "not_empty"
                                                                ]
                                                              },
                                                              "value": {
                                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                              },
                                                              "id": {
                                                                "type": "string",
                                                                "minLength": 1,
                                                                "maxLength": 100
                                                              },
                                                              "negated": {
                                                                "type": "boolean",
                                                                "enum": [
                                                                  true
                                                                ],
                                                                "description": "The rule matches the rows its condition does not."
                                                              },
                                                              "withheld": {
                                                                "type": "boolean",
                                                                "enum": [
                                                                  true
                                                                ],
                                                                "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                              }
                                                            }
                                                          },
                                                          {
                                                            "type": "object",
                                                            "additionalProperties": false,
                                                            "required": [
                                                              "type",
                                                              "combinator",
                                                              "rules"
                                                            ],
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "group"
                                                                ]
                                                              },
                                                              "combinator": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "and",
                                                                  "or"
                                                                ]
                                                              },
                                                              "rules": {
                                                                "type": "array",
                                                                "maxItems": 64,
                                                                "items": {
                                                                  "oneOf": [
                                                                    {
                                                                      "type": "object",
                                                                      "additionalProperties": false,
                                                                      "required": [
                                                                        "type",
                                                                        "columnId",
                                                                        "operator"
                                                                      ],
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "rule"
                                                                          ]
                                                                        },
                                                                        "columnId": {
                                                                          "type": "string",
                                                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                        },
                                                                        "operator": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "contains",
                                                                            "not_contains",
                                                                            "starts_with",
                                                                            "ends_with",
                                                                            "is",
                                                                            "is_not",
                                                                            "is_any_of",
                                                                            "is_none_of",
                                                                            "has_any_of",
                                                                            "has_all_of",
                                                                            "has_none_of",
                                                                            "eq",
                                                                            "neq",
                                                                            "gt",
                                                                            "gte",
                                                                            "lt",
                                                                            "lte",
                                                                            "between",
                                                                            "not_between",
                                                                            "is_before",
                                                                            "is_after",
                                                                            "is_on_or_before",
                                                                            "is_on_or_after",
                                                                            "empty",
                                                                            "not_empty"
                                                                          ]
                                                                        },
                                                                        "value": {
                                                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                        },
                                                                        "id": {
                                                                          "type": "string",
                                                                          "minLength": 1,
                                                                          "maxLength": 100
                                                                        },
                                                                        "negated": {
                                                                          "type": "boolean",
                                                                          "enum": [
                                                                            true
                                                                          ],
                                                                          "description": "The rule matches the rows its condition does not."
                                                                        },
                                                                        "withheld": {
                                                                          "type": "boolean",
                                                                          "enum": [
                                                                            true
                                                                          ],
                                                                          "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                        }
                                                                      }
                                                                    },
                                                                    {
                                                                      "type": "object",
                                                                      "additionalProperties": false,
                                                                      "required": [
                                                                        "type",
                                                                        "combinator",
                                                                        "rules"
                                                                      ],
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "group"
                                                                          ]
                                                                        },
                                                                        "combinator": {
                                                                          "type": "string",
                                                                          "enum": [
                                                                            "and",
                                                                            "or"
                                                                          ]
                                                                        },
                                                                        "rules": {
                                                                          "type": "array",
                                                                          "maxItems": 64,
                                                                          "items": {
                                                                            "oneOf": [
                                                                              {
                                                                                "type": "object",
                                                                                "additionalProperties": false,
                                                                                "required": [
                                                                                  "type",
                                                                                  "columnId",
                                                                                  "operator"
                                                                                ],
                                                                                "properties": {
                                                                                  "type": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "rule"
                                                                                    ]
                                                                                  },
                                                                                  "columnId": {
                                                                                    "type": "string",
                                                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                                  },
                                                                                  "operator": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "contains",
                                                                                      "not_contains",
                                                                                      "starts_with",
                                                                                      "ends_with",
                                                                                      "is",
                                                                                      "is_not",
                                                                                      "is_any_of",
                                                                                      "is_none_of",
                                                                                      "has_any_of",
                                                                                      "has_all_of",
                                                                                      "has_none_of",
                                                                                      "eq",
                                                                                      "neq",
                                                                                      "gt",
                                                                                      "gte",
                                                                                      "lt",
                                                                                      "lte",
                                                                                      "between",
                                                                                      "not_between",
                                                                                      "is_before",
                                                                                      "is_after",
                                                                                      "is_on_or_before",
                                                                                      "is_on_or_after",
                                                                                      "empty",
                                                                                      "not_empty"
                                                                                    ]
                                                                                  },
                                                                                  "value": {
                                                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                                  },
                                                                                  "id": {
                                                                                    "type": "string",
                                                                                    "minLength": 1,
                                                                                    "maxLength": 100
                                                                                  },
                                                                                  "negated": {
                                                                                    "type": "boolean",
                                                                                    "enum": [
                                                                                      true
                                                                                    ],
                                                                                    "description": "The rule matches the rows its condition does not."
                                                                                  },
                                                                                  "withheld": {
                                                                                    "type": "boolean",
                                                                                    "enum": [
                                                                                      true
                                                                                    ],
                                                                                    "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                                  }
                                                                                }
                                                                              },
                                                                              {
                                                                                "type": "object",
                                                                                "additionalProperties": false,
                                                                                "required": [
                                                                                  "type",
                                                                                  "combinator",
                                                                                  "rules"
                                                                                ],
                                                                                "properties": {
                                                                                  "type": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "group"
                                                                                    ]
                                                                                  },
                                                                                  "combinator": {
                                                                                    "type": "string",
                                                                                    "enum": [
                                                                                      "and",
                                                                                      "or"
                                                                                    ]
                                                                                  },
                                                                                  "rules": {
                                                                                    "type": "array",
                                                                                    "maxItems": 0
                                                                                  },
                                                                                  "id": {
                                                                                    "type": "string",
                                                                                    "minLength": 1,
                                                                                    "maxLength": 100
                                                                                  }
                                                                                }
                                                                              }
                                                                            ]
                                                                          }
                                                                        },
                                                                        "id": {
                                                                          "type": "string",
                                                                          "minLength": 1,
                                                                          "maxLength": 100
                                                                        }
                                                                      }
                                                                    }
                                                                  ]
                                                                }
                                                              },
                                                              "id": {
                                                                "type": "string",
                                                                "minLength": 1,
                                                                "maxLength": 100
                                                              }
                                                            }
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "id": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 100
                                                    }
                                                  }
                                                }
                                              ]
                                            }
                                          },
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 100
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "density": {
                                    "type": "string",
                                    "enum": [
                                      "compact",
                                      "comfortable"
                                    ]
                                  }
                                }
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "at",
                              "actor",
                              "batchId",
                              "kind"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actor": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "userId"
                                ],
                                "description": "An employer user, or an agent acting as one. No name or e-mail.",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "USER",
                                      "AGENT",
                                      "SYSTEM"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                }
                              },
                              "batchId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "preferences.updated"
                                ]
                              },
                              "defaultViewId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "lastOpenedViewId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "at",
                              "actor",
                              "batchId",
                              "kind",
                              "viewId"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actor": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "userId"
                                ],
                                "description": "An employer user, or an agent acting as one. No name or e-mail.",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "USER",
                                      "AGENT",
                                      "SYSTEM"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                }
                              },
                              "batchId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "job_default_view.updated"
                                ]
                              },
                              "viewId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "at",
                              "actor",
                              "batchId",
                              "kind",
                              "jobPersonId",
                              "version",
                              "etag",
                              "sizeChars",
                              "revisionId"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actor": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "kind",
                                  "userId"
                                ],
                                "description": "An employer user, or an agent acting as one. No name or e-mail.",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "USER",
                                      "AGENT",
                                      "SYSTEM"
                                    ]
                                  },
                                  "userId": {
                                    "type": "string"
                                  }
                                }
                              },
                              "batchId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "agent_notes.created",
                                  "agent_notes.appended",
                                  "agent_notes.replaced",
                                  "agent_notes.archived"
                                ]
                              },
                              "jobPersonId": {
                                "type": "string"
                              },
                              "version": {
                                "type": "integer"
                              },
                              "etag": {
                                "type": "string"
                              },
                              "sizeChars": {
                                "type": "integer"
                              },
                              "revisionId": {
                                "type": "string"
                              }
                            }
                          }
                        ]
                      }
                    },
                    "page": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "limit",
                        "hasMore",
                        "nextCursor"
                      ],
                      "properties": {
                        "limit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 200
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "nextCursor": {
                          "type": "string",
                          "maxLength": 1024
                        }
                      }
                    },
                    "settledThrough": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "schemaEtag": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "VALIDATION (since, cursor, limit) or CURSOR_INVALID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "CHANGES_CURSOR_EXPIRED: the cursor is older than limits.changes.cursorMaxAgeDays; describe and query again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Read budget spent, two People table reads already in flight for this key, or the server at its People table read capacity (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "READ_TIMEOUT: the read passed its database bound (10 s a statement, 15 s in all); narrow the request or retry after Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/views": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "List the job People table views this key can open",
        "description": "Requires `people_table:read` and employer access to the job (`people_table.views.list`). Built-in views, the job’s ORGANIZATION views and the caller’s own PERSONAL views, with configs over describe column ids, permissions and the caller’s defaults. `includeArchived=true` adds archived ORGANIZATION and own PERSONAL views. Another member’s PERSONAL view is never listed. A filter rule on a column this key cannot query reads with `withheld: true` and no value (I5).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Views",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "views",
                    "defaults",
                    "schemaEtag"
                  ],
                  "properties": {
                    "views": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "name",
                          "scope",
                          "version",
                          "archivedAt",
                          "config",
                          "permissions"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "BUILT_IN",
                              "PERSONAL",
                              "ORGANIZATION"
                            ]
                          },
                          "version": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "archivedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "config": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "columnOrder",
                              "columnVisibility",
                              "columnPinning",
                              "columnSizing",
                              "sort",
                              "filter",
                              "density"
                            ],
                            "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                            "properties": {
                              "columnOrder": {
                                "type": "array",
                                "maxItems": 256,
                                "items": {
                                  "type": "string",
                                  "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                }
                              },
                              "columnVisibility": {
                                "type": "object",
                                "maxProperties": 256,
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                },
                                "additionalProperties": {
                                  "type": "boolean"
                                }
                              },
                              "columnPinning": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "start",
                                  "end"
                                ],
                                "properties": {
                                  "start": {
                                    "type": "array",
                                    "maxItems": 256,
                                    "items": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    }
                                  },
                                  "end": {
                                    "type": "array",
                                    "maxItems": 256,
                                    "items": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    }
                                  }
                                }
                              },
                              "columnSizing": {
                                "type": "object",
                                "maxProperties": 256,
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                },
                                "additionalProperties": {
                                  "type": "integer",
                                  "minimum": 72,
                                  "maximum": 800
                                }
                              },
                              "sort": {
                                "type": "array",
                                "maxItems": 5,
                                "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "columnId",
                                    "direction"
                                  ],
                                  "properties": {
                                    "columnId": {
                                      "type": "string",
                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                    },
                                    "direction": {
                                      "type": "string",
                                      "enum": [
                                        "asc",
                                        "desc"
                                      ]
                                    }
                                  }
                                }
                              },
                              "filter": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "type",
                                      "combinator",
                                      "rules"
                                    ],
                                    "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "enum": [
                                          "group"
                                        ]
                                      },
                                      "combinator": {
                                        "type": "string",
                                        "enum": [
                                          "and",
                                          "or"
                                        ]
                                      },
                                      "rules": {
                                        "type": "array",
                                        "maxItems": 64,
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "type",
                                                "columnId",
                                                "operator"
                                              ],
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "rule"
                                                  ]
                                                },
                                                "columnId": {
                                                  "type": "string",
                                                  "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                },
                                                "operator": {
                                                  "type": "string",
                                                  "enum": [
                                                    "contains",
                                                    "not_contains",
                                                    "starts_with",
                                                    "ends_with",
                                                    "is",
                                                    "is_not",
                                                    "is_any_of",
                                                    "is_none_of",
                                                    "has_any_of",
                                                    "has_all_of",
                                                    "has_none_of",
                                                    "eq",
                                                    "neq",
                                                    "gt",
                                                    "gte",
                                                    "lt",
                                                    "lte",
                                                    "between",
                                                    "not_between",
                                                    "is_before",
                                                    "is_after",
                                                    "is_on_or_before",
                                                    "is_on_or_after",
                                                    "empty",
                                                    "not_empty"
                                                  ]
                                                },
                                                "value": {
                                                  "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                },
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 100
                                                },
                                                "negated": {
                                                  "type": "boolean",
                                                  "enum": [
                                                    true
                                                  ],
                                                  "description": "The rule matches the rows its condition does not."
                                                },
                                                "withheld": {
                                                  "type": "boolean",
                                                  "enum": [
                                                    true
                                                  ],
                                                  "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                }
                                              }
                                            },
                                            {
                                              "type": "object",
                                              "additionalProperties": false,
                                              "required": [
                                                "type",
                                                "combinator",
                                                "rules"
                                              ],
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "group"
                                                  ]
                                                },
                                                "combinator": {
                                                  "type": "string",
                                                  "enum": [
                                                    "and",
                                                    "or"
                                                  ]
                                                },
                                                "rules": {
                                                  "type": "array",
                                                  "maxItems": 64,
                                                  "items": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "type",
                                                          "columnId",
                                                          "operator"
                                                        ],
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "enum": [
                                                              "rule"
                                                            ]
                                                          },
                                                          "columnId": {
                                                            "type": "string",
                                                            "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                          },
                                                          "operator": {
                                                            "type": "string",
                                                            "enum": [
                                                              "contains",
                                                              "not_contains",
                                                              "starts_with",
                                                              "ends_with",
                                                              "is",
                                                              "is_not",
                                                              "is_any_of",
                                                              "is_none_of",
                                                              "has_any_of",
                                                              "has_all_of",
                                                              "has_none_of",
                                                              "eq",
                                                              "neq",
                                                              "gt",
                                                              "gte",
                                                              "lt",
                                                              "lte",
                                                              "between",
                                                              "not_between",
                                                              "is_before",
                                                              "is_after",
                                                              "is_on_or_before",
                                                              "is_on_or_after",
                                                              "empty",
                                                              "not_empty"
                                                            ]
                                                          },
                                                          "value": {
                                                            "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                          },
                                                          "id": {
                                                            "type": "string",
                                                            "minLength": 1,
                                                            "maxLength": 100
                                                          },
                                                          "negated": {
                                                            "type": "boolean",
                                                            "enum": [
                                                              true
                                                            ],
                                                            "description": "The rule matches the rows its condition does not."
                                                          },
                                                          "withheld": {
                                                            "type": "boolean",
                                                            "enum": [
                                                              true
                                                            ],
                                                            "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                          }
                                                        }
                                                      },
                                                      {
                                                        "type": "object",
                                                        "additionalProperties": false,
                                                        "required": [
                                                          "type",
                                                          "combinator",
                                                          "rules"
                                                        ],
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "enum": [
                                                              "group"
                                                            ]
                                                          },
                                                          "combinator": {
                                                            "type": "string",
                                                            "enum": [
                                                              "and",
                                                              "or"
                                                            ]
                                                          },
                                                          "rules": {
                                                            "type": "array",
                                                            "maxItems": 64,
                                                            "items": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "additionalProperties": false,
                                                                  "required": [
                                                                    "type",
                                                                    "columnId",
                                                                    "operator"
                                                                  ],
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "rule"
                                                                      ]
                                                                    },
                                                                    "columnId": {
                                                                      "type": "string",
                                                                      "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                    },
                                                                    "operator": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "contains",
                                                                        "not_contains",
                                                                        "starts_with",
                                                                        "ends_with",
                                                                        "is",
                                                                        "is_not",
                                                                        "is_any_of",
                                                                        "is_none_of",
                                                                        "has_any_of",
                                                                        "has_all_of",
                                                                        "has_none_of",
                                                                        "eq",
                                                                        "neq",
                                                                        "gt",
                                                                        "gte",
                                                                        "lt",
                                                                        "lte",
                                                                        "between",
                                                                        "not_between",
                                                                        "is_before",
                                                                        "is_after",
                                                                        "is_on_or_before",
                                                                        "is_on_or_after",
                                                                        "empty",
                                                                        "not_empty"
                                                                      ]
                                                                    },
                                                                    "value": {
                                                                      "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                    },
                                                                    "id": {
                                                                      "type": "string",
                                                                      "minLength": 1,
                                                                      "maxLength": 100
                                                                    },
                                                                    "negated": {
                                                                      "type": "boolean",
                                                                      "enum": [
                                                                        true
                                                                      ],
                                                                      "description": "The rule matches the rows its condition does not."
                                                                    },
                                                                    "withheld": {
                                                                      "type": "boolean",
                                                                      "enum": [
                                                                        true
                                                                      ],
                                                                      "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                    }
                                                                  }
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "additionalProperties": false,
                                                                  "required": [
                                                                    "type",
                                                                    "combinator",
                                                                    "rules"
                                                                  ],
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "group"
                                                                      ]
                                                                    },
                                                                    "combinator": {
                                                                      "type": "string",
                                                                      "enum": [
                                                                        "and",
                                                                        "or"
                                                                      ]
                                                                    },
                                                                    "rules": {
                                                                      "type": "array",
                                                                      "maxItems": 64,
                                                                      "items": {
                                                                        "oneOf": [
                                                                          {
                                                                            "type": "object",
                                                                            "additionalProperties": false,
                                                                            "required": [
                                                                              "type",
                                                                              "columnId",
                                                                              "operator"
                                                                            ],
                                                                            "properties": {
                                                                              "type": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "rule"
                                                                                ]
                                                                              },
                                                                              "columnId": {
                                                                                "type": "string",
                                                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                              },
                                                                              "operator": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "contains",
                                                                                  "not_contains",
                                                                                  "starts_with",
                                                                                  "ends_with",
                                                                                  "is",
                                                                                  "is_not",
                                                                                  "is_any_of",
                                                                                  "is_none_of",
                                                                                  "has_any_of",
                                                                                  "has_all_of",
                                                                                  "has_none_of",
                                                                                  "eq",
                                                                                  "neq",
                                                                                  "gt",
                                                                                  "gte",
                                                                                  "lt",
                                                                                  "lte",
                                                                                  "between",
                                                                                  "not_between",
                                                                                  "is_before",
                                                                                  "is_after",
                                                                                  "is_on_or_before",
                                                                                  "is_on_or_after",
                                                                                  "empty",
                                                                                  "not_empty"
                                                                                ]
                                                                              },
                                                                              "value": {
                                                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                              },
                                                                              "id": {
                                                                                "type": "string",
                                                                                "minLength": 1,
                                                                                "maxLength": 100
                                                                              },
                                                                              "negated": {
                                                                                "type": "boolean",
                                                                                "enum": [
                                                                                  true
                                                                                ],
                                                                                "description": "The rule matches the rows its condition does not."
                                                                              },
                                                                              "withheld": {
                                                                                "type": "boolean",
                                                                                "enum": [
                                                                                  true
                                                                                ],
                                                                                "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                              }
                                                                            }
                                                                          },
                                                                          {
                                                                            "type": "object",
                                                                            "additionalProperties": false,
                                                                            "required": [
                                                                              "type",
                                                                              "combinator",
                                                                              "rules"
                                                                            ],
                                                                            "properties": {
                                                                              "type": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "group"
                                                                                ]
                                                                              },
                                                                              "combinator": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                  "and",
                                                                                  "or"
                                                                                ]
                                                                              },
                                                                              "rules": {
                                                                                "type": "array",
                                                                                "maxItems": 0
                                                                              },
                                                                              "id": {
                                                                                "type": "string",
                                                                                "minLength": 1,
                                                                                "maxLength": 100
                                                                              }
                                                                            }
                                                                          }
                                                                        ]
                                                                      }
                                                                    },
                                                                    "id": {
                                                                      "type": "string",
                                                                      "minLength": 1,
                                                                      "maxLength": 100
                                                                    }
                                                                  }
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "id": {
                                                            "type": "string",
                                                            "minLength": 1,
                                                            "maxLength": 100
                                                          }
                                                        }
                                                      }
                                                    ]
                                                  }
                                                },
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 100
                                                }
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      "id": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 100
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "density": {
                                "type": "string",
                                "enum": [
                                  "compact",
                                  "comfortable"
                                ]
                              }
                            }
                          },
                          "permissions": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "canEdit",
                              "canArchive",
                              "canRestore",
                              "canSetJobDefault"
                            ],
                            "properties": {
                              "canEdit": {
                                "type": "boolean"
                              },
                              "canArchive": {
                                "type": "boolean"
                              },
                              "canRestore": {
                                "type": "boolean"
                              },
                              "canSetJobDefault": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      }
                    },
                    "defaults": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "personalDefaultViewId",
                        "jobDefaultViewId",
                        "lastOpenedViewId",
                        "resolvedViewId"
                      ],
                      "description": "Stored view preferences and the job default; each id names a view in views, or is null. resolvedViewId is the view a rows query without viewId applies.",
                      "properties": {
                        "personalDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "jobDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lastOpenedViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "resolvedViewId": {
                          "type": "string"
                        }
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_QUERY (includeArchived)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Read budget spent, two People table reads already in flight for this key, or the server at its People table read capacity (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "READ_TIMEOUT: the read passed its database bound (10 s a statement, 15 s in all); narrow the request or retry after Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Create a personal or organization view of the job People table",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.views.create`). Through the web view service: a name of 1–64 characters, not \"All People\", unique among the active views of its scope. Every filter rule and sort must name a column this key can filter or sort (`400` COLUMN_NOT_QUERYABLE), with an operator its type allows and a value the web rules keep (INVALID_FILTER); at most five sorts and the filter limits (LIMIT_EXCEEDED). A new view has no withheld rules. The audit event records actor kind AGENT and the receipt id as batch id; a replay of the same key and body answers `replayed: true` with the view as the write committed it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "scope",
                  "config"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "\\S",
                    "description": "1–64 characters with at least one that is not a space; trimmed, not \"All People\", and unique among the active views of its scope, ignoring case."
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "PERSONAL",
                      "ORGANIZATION"
                    ]
                  },
                  "config": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "columnOrder",
                      "columnVisibility",
                      "columnPinning",
                      "columnSizing",
                      "sort",
                      "filter",
                      "density"
                    ],
                    "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                    "properties": {
                      "columnOrder": {
                        "type": "array",
                        "maxItems": 256,
                        "items": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        }
                      },
                      "columnVisibility": {
                        "type": "object",
                        "maxProperties": 256,
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        },
                        "additionalProperties": {
                          "type": "boolean"
                        }
                      },
                      "columnPinning": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "start",
                          "end"
                        ],
                        "properties": {
                          "start": {
                            "type": "array",
                            "maxItems": 256,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                            }
                          },
                          "end": {
                            "type": "array",
                            "maxItems": 256,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                            }
                          }
                        }
                      },
                      "columnSizing": {
                        "type": "object",
                        "maxProperties": 256,
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        },
                        "additionalProperties": {
                          "type": "integer",
                          "minimum": 72,
                          "maximum": 800
                        }
                      },
                      "sort": {
                        "type": "array",
                        "maxItems": 5,
                        "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "columnId",
                            "direction"
                          ],
                          "properties": {
                            "columnId": {
                              "type": "string",
                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                            },
                            "direction": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          }
                        }
                      },
                      "filter": {
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "combinator",
                              "rules"
                            ],
                            "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "group"
                                ]
                              },
                              "combinator": {
                                "type": "string",
                                "enum": [
                                  "and",
                                  "or"
                                ]
                              },
                              "rules": {
                                "type": "array",
                                "maxItems": 64,
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "type",
                                        "columnId",
                                        "operator"
                                      ],
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "rule"
                                          ]
                                        },
                                        "columnId": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        },
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "contains",
                                            "not_contains",
                                            "starts_with",
                                            "ends_with",
                                            "is",
                                            "is_not",
                                            "is_any_of",
                                            "is_none_of",
                                            "has_any_of",
                                            "has_all_of",
                                            "has_none_of",
                                            "eq",
                                            "neq",
                                            "gt",
                                            "gte",
                                            "lt",
                                            "lte",
                                            "between",
                                            "not_between",
                                            "is_before",
                                            "is_after",
                                            "is_on_or_before",
                                            "is_on_or_after",
                                            "empty",
                                            "not_empty"
                                          ]
                                        },
                                        "value": {
                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                        },
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 100
                                        },
                                        "negated": {
                                          "type": "boolean",
                                          "enum": [
                                            true
                                          ],
                                          "description": "The rule matches the rows its condition does not."
                                        },
                                        "withheld": {
                                          "type": "boolean",
                                          "enum": [
                                            true
                                          ],
                                          "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "type",
                                        "combinator",
                                        "rules"
                                      ],
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "group"
                                          ]
                                        },
                                        "combinator": {
                                          "type": "string",
                                          "enum": [
                                            "and",
                                            "or"
                                          ]
                                        },
                                        "rules": {
                                          "type": "array",
                                          "maxItems": 64,
                                          "items": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "required": [
                                                  "type",
                                                  "columnId",
                                                  "operator"
                                                ],
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "rule"
                                                    ]
                                                  },
                                                  "columnId": {
                                                    "type": "string",
                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                  },
                                                  "operator": {
                                                    "type": "string",
                                                    "enum": [
                                                      "contains",
                                                      "not_contains",
                                                      "starts_with",
                                                      "ends_with",
                                                      "is",
                                                      "is_not",
                                                      "is_any_of",
                                                      "is_none_of",
                                                      "has_any_of",
                                                      "has_all_of",
                                                      "has_none_of",
                                                      "eq",
                                                      "neq",
                                                      "gt",
                                                      "gte",
                                                      "lt",
                                                      "lte",
                                                      "between",
                                                      "not_between",
                                                      "is_before",
                                                      "is_after",
                                                      "is_on_or_before",
                                                      "is_on_or_after",
                                                      "empty",
                                                      "not_empty"
                                                    ]
                                                  },
                                                  "value": {
                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                  },
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 100
                                                  },
                                                  "negated": {
                                                    "type": "boolean",
                                                    "enum": [
                                                      true
                                                    ],
                                                    "description": "The rule matches the rows its condition does not."
                                                  },
                                                  "withheld": {
                                                    "type": "boolean",
                                                    "enum": [
                                                      true
                                                    ],
                                                    "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                  }
                                                }
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "required": [
                                                  "type",
                                                  "combinator",
                                                  "rules"
                                                ],
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "group"
                                                    ]
                                                  },
                                                  "combinator": {
                                                    "type": "string",
                                                    "enum": [
                                                      "and",
                                                      "or"
                                                    ]
                                                  },
                                                  "rules": {
                                                    "type": "array",
                                                    "maxItems": 64,
                                                    "items": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "additionalProperties": false,
                                                          "required": [
                                                            "type",
                                                            "columnId",
                                                            "operator"
                                                          ],
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "enum": [
                                                                "rule"
                                                              ]
                                                            },
                                                            "columnId": {
                                                              "type": "string",
                                                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                            },
                                                            "operator": {
                                                              "type": "string",
                                                              "enum": [
                                                                "contains",
                                                                "not_contains",
                                                                "starts_with",
                                                                "ends_with",
                                                                "is",
                                                                "is_not",
                                                                "is_any_of",
                                                                "is_none_of",
                                                                "has_any_of",
                                                                "has_all_of",
                                                                "has_none_of",
                                                                "eq",
                                                                "neq",
                                                                "gt",
                                                                "gte",
                                                                "lt",
                                                                "lte",
                                                                "between",
                                                                "not_between",
                                                                "is_before",
                                                                "is_after",
                                                                "is_on_or_before",
                                                                "is_on_or_after",
                                                                "empty",
                                                                "not_empty"
                                                              ]
                                                            },
                                                            "value": {
                                                              "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                            },
                                                            "id": {
                                                              "type": "string",
                                                              "minLength": 1,
                                                              "maxLength": 100
                                                            },
                                                            "negated": {
                                                              "type": "boolean",
                                                              "enum": [
                                                                true
                                                              ],
                                                              "description": "The rule matches the rows its condition does not."
                                                            },
                                                            "withheld": {
                                                              "type": "boolean",
                                                              "enum": [
                                                                true
                                                              ],
                                                              "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                            }
                                                          }
                                                        },
                                                        {
                                                          "type": "object",
                                                          "additionalProperties": false,
                                                          "required": [
                                                            "type",
                                                            "combinator",
                                                            "rules"
                                                          ],
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "enum": [
                                                                "group"
                                                              ]
                                                            },
                                                            "combinator": {
                                                              "type": "string",
                                                              "enum": [
                                                                "and",
                                                                "or"
                                                              ]
                                                            },
                                                            "rules": {
                                                              "type": "array",
                                                              "maxItems": 64,
                                                              "items": {
                                                                "oneOf": [
                                                                  {
                                                                    "type": "object",
                                                                    "additionalProperties": false,
                                                                    "required": [
                                                                      "type",
                                                                      "columnId",
                                                                      "operator"
                                                                    ],
                                                                    "properties": {
                                                                      "type": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "rule"
                                                                        ]
                                                                      },
                                                                      "columnId": {
                                                                        "type": "string",
                                                                        "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                      },
                                                                      "operator": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "contains",
                                                                          "not_contains",
                                                                          "starts_with",
                                                                          "ends_with",
                                                                          "is",
                                                                          "is_not",
                                                                          "is_any_of",
                                                                          "is_none_of",
                                                                          "has_any_of",
                                                                          "has_all_of",
                                                                          "has_none_of",
                                                                          "eq",
                                                                          "neq",
                                                                          "gt",
                                                                          "gte",
                                                                          "lt",
                                                                          "lte",
                                                                          "between",
                                                                          "not_between",
                                                                          "is_before",
                                                                          "is_after",
                                                                          "is_on_or_before",
                                                                          "is_on_or_after",
                                                                          "empty",
                                                                          "not_empty"
                                                                        ]
                                                                      },
                                                                      "value": {
                                                                        "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                      },
                                                                      "id": {
                                                                        "type": "string",
                                                                        "minLength": 1,
                                                                        "maxLength": 100
                                                                      },
                                                                      "negated": {
                                                                        "type": "boolean",
                                                                        "enum": [
                                                                          true
                                                                        ],
                                                                        "description": "The rule matches the rows its condition does not."
                                                                      },
                                                                      "withheld": {
                                                                        "type": "boolean",
                                                                        "enum": [
                                                                          true
                                                                        ],
                                                                        "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                      }
                                                                    }
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "additionalProperties": false,
                                                                    "required": [
                                                                      "type",
                                                                      "combinator",
                                                                      "rules"
                                                                    ],
                                                                    "properties": {
                                                                      "type": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "group"
                                                                        ]
                                                                      },
                                                                      "combinator": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "and",
                                                                          "or"
                                                                        ]
                                                                      },
                                                                      "rules": {
                                                                        "type": "array",
                                                                        "maxItems": 0
                                                                      },
                                                                      "id": {
                                                                        "type": "string",
                                                                        "minLength": 1,
                                                                        "maxLength": 100
                                                                      }
                                                                    }
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "id": {
                                                              "type": "string",
                                                              "minLength": 1,
                                                              "maxLength": 100
                                                            }
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 100
                                                  }
                                                }
                                              }
                                            ]
                                          }
                                        },
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 100
                                        }
                                      }
                                    }
                                  ]
                                }
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "density": {
                        "type": "string",
                        "enum": [
                          "compact",
                          "comfortable"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "View created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "view",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "view": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "name",
                        "scope",
                        "version",
                        "archivedAt",
                        "config",
                        "permissions"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "BUILT_IN",
                            "PERSONAL",
                            "ORGANIZATION"
                          ]
                        },
                        "version": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "config": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "columnOrder",
                            "columnVisibility",
                            "columnPinning",
                            "columnSizing",
                            "sort",
                            "filter",
                            "density"
                          ],
                          "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                          "properties": {
                            "columnOrder": {
                              "type": "array",
                              "maxItems": 256,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              }
                            },
                            "columnVisibility": {
                              "type": "object",
                              "maxProperties": 256,
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "additionalProperties": {
                                "type": "boolean"
                              }
                            },
                            "columnPinning": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "start",
                                "end"
                              ],
                              "properties": {
                                "start": {
                                  "type": "array",
                                  "maxItems": 256,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  }
                                },
                                "end": {
                                  "type": "array",
                                  "maxItems": 256,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  }
                                }
                              }
                            },
                            "columnSizing": {
                              "type": "object",
                              "maxProperties": 256,
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "additionalProperties": {
                                "type": "integer",
                                "minimum": 72,
                                "maximum": 800
                              }
                            },
                            "sort": {
                              "type": "array",
                              "maxItems": 5,
                              "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "columnId",
                                  "direction"
                                ],
                                "properties": {
                                  "columnId": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  },
                                  "direction": {
                                    "type": "string",
                                    "enum": [
                                      "asc",
                                      "desc"
                                    ]
                                  }
                                }
                              }
                            },
                            "filter": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "type",
                                    "combinator",
                                    "rules"
                                  ],
                                  "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "group"
                                      ]
                                    },
                                    "combinator": {
                                      "type": "string",
                                      "enum": [
                                        "and",
                                        "or"
                                      ]
                                    },
                                    "rules": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "columnId",
                                              "operator"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "rule"
                                                ]
                                              },
                                              "columnId": {
                                                "type": "string",
                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                              },
                                              "operator": {
                                                "type": "string",
                                                "enum": [
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "is",
                                                  "is_not",
                                                  "is_any_of",
                                                  "is_none_of",
                                                  "has_any_of",
                                                  "has_all_of",
                                                  "has_none_of",
                                                  "eq",
                                                  "neq",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "between",
                                                  "not_between",
                                                  "is_before",
                                                  "is_after",
                                                  "is_on_or_before",
                                                  "is_on_or_after",
                                                  "empty",
                                                  "not_empty"
                                                ]
                                              },
                                              "value": {
                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                              },
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 100
                                              },
                                              "negated": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "The rule matches the rows its condition does not."
                                              },
                                              "withheld": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                              }
                                            }
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "combinator",
                                              "rules"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "group"
                                                ]
                                              },
                                              "combinator": {
                                                "type": "string",
                                                "enum": [
                                                  "and",
                                                  "or"
                                                ]
                                              },
                                              "rules": {
                                                "type": "array",
                                                "maxItems": 64,
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "columnId",
                                                        "operator"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "rule"
                                                          ]
                                                        },
                                                        "columnId": {
                                                          "type": "string",
                                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                        },
                                                        "operator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "contains",
                                                            "not_contains",
                                                            "starts_with",
                                                            "ends_with",
                                                            "is",
                                                            "is_not",
                                                            "is_any_of",
                                                            "is_none_of",
                                                            "has_any_of",
                                                            "has_all_of",
                                                            "has_none_of",
                                                            "eq",
                                                            "neq",
                                                            "gt",
                                                            "gte",
                                                            "lt",
                                                            "lte",
                                                            "between",
                                                            "not_between",
                                                            "is_before",
                                                            "is_after",
                                                            "is_on_or_before",
                                                            "is_on_or_after",
                                                            "empty",
                                                            "not_empty"
                                                          ]
                                                        },
                                                        "value": {
                                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 100
                                                        },
                                                        "negated": {
                                                          "type": "boolean",
                                                          "enum": [
                                                            true
                                                          ],
                                                          "description": "The rule matches the rows its condition does not."
                                                        },
                                                        "withheld": {
                                                          "type": "boolean",
                                                          "enum": [
                                                            true
                                                          ],
                                                          "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                        }
                                                      }
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "combinator",
                                                        "rules"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "group"
                                                          ]
                                                        },
                                                        "combinator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "and",
                                                            "or"
                                                          ]
                                                        },
                                                        "rules": {
                                                          "type": "array",
                                                          "maxItems": 64,
                                                          "items": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "columnId",
                                                                  "operator"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "rule"
                                                                    ]
                                                                  },
                                                                  "columnId": {
                                                                    "type": "string",
                                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                  },
                                                                  "operator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "contains",
                                                                      "not_contains",
                                                                      "starts_with",
                                                                      "ends_with",
                                                                      "is",
                                                                      "is_not",
                                                                      "is_any_of",
                                                                      "is_none_of",
                                                                      "has_any_of",
                                                                      "has_all_of",
                                                                      "has_none_of",
                                                                      "eq",
                                                                      "neq",
                                                                      "gt",
                                                                      "gte",
                                                                      "lt",
                                                                      "lte",
                                                                      "between",
                                                                      "not_between",
                                                                      "is_before",
                                                                      "is_after",
                                                                      "is_on_or_before",
                                                                      "is_on_or_after",
                                                                      "empty",
                                                                      "not_empty"
                                                                    ]
                                                                  },
                                                                  "value": {
                                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 100
                                                                  },
                                                                  "negated": {
                                                                    "type": "boolean",
                                                                    "enum": [
                                                                      true
                                                                    ],
                                                                    "description": "The rule matches the rows its condition does not."
                                                                  },
                                                                  "withheld": {
                                                                    "type": "boolean",
                                                                    "enum": [
                                                                      true
                                                                    ],
                                                                    "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                  }
                                                                }
                                                              },
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "combinator",
                                                                  "rules"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "group"
                                                                    ]
                                                                  },
                                                                  "combinator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "and",
                                                                      "or"
                                                                    ]
                                                                  },
                                                                  "rules": {
                                                                    "type": "array",
                                                                    "maxItems": 64,
                                                                    "items": {
                                                                      "oneOf": [
                                                                        {
                                                                          "type": "object",
                                                                          "additionalProperties": false,
                                                                          "required": [
                                                                            "type",
                                                                            "columnId",
                                                                            "operator"
                                                                          ],
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "rule"
                                                                              ]
                                                                            },
                                                                            "columnId": {
                                                                              "type": "string",
                                                                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                            },
                                                                            "operator": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "contains",
                                                                                "not_contains",
                                                                                "starts_with",
                                                                                "ends_with",
                                                                                "is",
                                                                                "is_not",
                                                                                "is_any_of",
                                                                                "is_none_of",
                                                                                "has_any_of",
                                                                                "has_all_of",
                                                                                "has_none_of",
                                                                                "eq",
                                                                                "neq",
                                                                                "gt",
                                                                                "gte",
                                                                                "lt",
                                                                                "lte",
                                                                                "between",
                                                                                "not_between",
                                                                                "is_before",
                                                                                "is_after",
                                                                                "is_on_or_before",
                                                                                "is_on_or_after",
                                                                                "empty",
                                                                                "not_empty"
                                                                              ]
                                                                            },
                                                                            "value": {
                                                                              "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                            },
                                                                            "id": {
                                                                              "type": "string",
                                                                              "minLength": 1,
                                                                              "maxLength": 100
                                                                            },
                                                                            "negated": {
                                                                              "type": "boolean",
                                                                              "enum": [
                                                                                true
                                                                              ],
                                                                              "description": "The rule matches the rows its condition does not."
                                                                            },
                                                                            "withheld": {
                                                                              "type": "boolean",
                                                                              "enum": [
                                                                                true
                                                                              ],
                                                                              "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                            }
                                                                          }
                                                                        },
                                                                        {
                                                                          "type": "object",
                                                                          "additionalProperties": false,
                                                                          "required": [
                                                                            "type",
                                                                            "combinator",
                                                                            "rules"
                                                                          ],
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "group"
                                                                              ]
                                                                            },
                                                                            "combinator": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "and",
                                                                                "or"
                                                                              ]
                                                                            },
                                                                            "rules": {
                                                                              "type": "array",
                                                                              "maxItems": 0
                                                                            },
                                                                            "id": {
                                                                              "type": "string",
                                                                              "minLength": 1,
                                                                              "maxLength": 100
                                                                            }
                                                                          }
                                                                        }
                                                                      ]
                                                                    }
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 100
                                                                  }
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 100
                                                        }
                                                      }
                                                    }
                                                  ]
                                                }
                                              },
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 100
                                              }
                                            }
                                          }
                                        ]
                                      }
                                    },
                                    "id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 100
                                    }
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "density": {
                              "type": "string",
                              "enum": [
                                "compact",
                                "comfortable"
                              ]
                            }
                          }
                        },
                        "permissions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "canEdit",
                            "canArchive",
                            "canRestore",
                            "canSetJobDefault"
                          ],
                          "properties": {
                            "canEdit": {
                              "type": "boolean"
                            },
                            "canArchive": {
                              "type": "boolean"
                            },
                            "canRestore": {
                              "type": "boolean"
                            },
                            "canSetJobDefault": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, VALIDATION, COLUMN_NOT_QUERYABLE, INVALID_FILTER, LIMIT_EXCEEDED or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (foreign jobs are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/views/{viewId}": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Read one job People table view",
        "description": "Requires `people_table:read` and employer access to the job (`people_table.views.get`). One view the caller can open, archived ones included: a built-in view, an ORGANIZATION view or the caller’s own PERSONAL view. Another member’s PERSONAL view is the same 404 as an unknown id (I7). Withheld rules as in `views.list`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "viewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "View",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "view",
                    "schemaEtag"
                  ],
                  "properties": {
                    "view": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "name",
                        "scope",
                        "version",
                        "archivedAt",
                        "config",
                        "permissions"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "BUILT_IN",
                            "PERSONAL",
                            "ORGANIZATION"
                          ]
                        },
                        "version": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "config": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "columnOrder",
                            "columnVisibility",
                            "columnPinning",
                            "columnSizing",
                            "sort",
                            "filter",
                            "density"
                          ],
                          "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                          "properties": {
                            "columnOrder": {
                              "type": "array",
                              "maxItems": 256,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              }
                            },
                            "columnVisibility": {
                              "type": "object",
                              "maxProperties": 256,
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "additionalProperties": {
                                "type": "boolean"
                              }
                            },
                            "columnPinning": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "start",
                                "end"
                              ],
                              "properties": {
                                "start": {
                                  "type": "array",
                                  "maxItems": 256,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  }
                                },
                                "end": {
                                  "type": "array",
                                  "maxItems": 256,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  }
                                }
                              }
                            },
                            "columnSizing": {
                              "type": "object",
                              "maxProperties": 256,
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "additionalProperties": {
                                "type": "integer",
                                "minimum": 72,
                                "maximum": 800
                              }
                            },
                            "sort": {
                              "type": "array",
                              "maxItems": 5,
                              "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "columnId",
                                  "direction"
                                ],
                                "properties": {
                                  "columnId": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  },
                                  "direction": {
                                    "type": "string",
                                    "enum": [
                                      "asc",
                                      "desc"
                                    ]
                                  }
                                }
                              }
                            },
                            "filter": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "type",
                                    "combinator",
                                    "rules"
                                  ],
                                  "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "group"
                                      ]
                                    },
                                    "combinator": {
                                      "type": "string",
                                      "enum": [
                                        "and",
                                        "or"
                                      ]
                                    },
                                    "rules": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "columnId",
                                              "operator"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "rule"
                                                ]
                                              },
                                              "columnId": {
                                                "type": "string",
                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                              },
                                              "operator": {
                                                "type": "string",
                                                "enum": [
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "is",
                                                  "is_not",
                                                  "is_any_of",
                                                  "is_none_of",
                                                  "has_any_of",
                                                  "has_all_of",
                                                  "has_none_of",
                                                  "eq",
                                                  "neq",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "between",
                                                  "not_between",
                                                  "is_before",
                                                  "is_after",
                                                  "is_on_or_before",
                                                  "is_on_or_after",
                                                  "empty",
                                                  "not_empty"
                                                ]
                                              },
                                              "value": {
                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                              },
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 100
                                              },
                                              "negated": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "The rule matches the rows its condition does not."
                                              },
                                              "withheld": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                              }
                                            }
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "combinator",
                                              "rules"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "group"
                                                ]
                                              },
                                              "combinator": {
                                                "type": "string",
                                                "enum": [
                                                  "and",
                                                  "or"
                                                ]
                                              },
                                              "rules": {
                                                "type": "array",
                                                "maxItems": 64,
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "columnId",
                                                        "operator"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "rule"
                                                          ]
                                                        },
                                                        "columnId": {
                                                          "type": "string",
                                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                        },
                                                        "operator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "contains",
                                                            "not_contains",
                                                            "starts_with",
                                                            "ends_with",
                                                            "is",
                                                            "is_not",
                                                            "is_any_of",
                                                            "is_none_of",
                                                            "has_any_of",
                                                            "has_all_of",
                                                            "has_none_of",
                                                            "eq",
                                                            "neq",
                                                            "gt",
                                                            "gte",
                                                            "lt",
                                                            "lte",
                                                            "between",
                                                            "not_between",
                                                            "is_before",
                                                            "is_after",
                                                            "is_on_or_before",
                                                            "is_on_or_after",
                                                            "empty",
                                                            "not_empty"
                                                          ]
                                                        },
                                                        "value": {
                                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 100
                                                        },
                                                        "negated": {
                                                          "type": "boolean",
                                                          "enum": [
                                                            true
                                                          ],
                                                          "description": "The rule matches the rows its condition does not."
                                                        },
                                                        "withheld": {
                                                          "type": "boolean",
                                                          "enum": [
                                                            true
                                                          ],
                                                          "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                        }
                                                      }
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "combinator",
                                                        "rules"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "group"
                                                          ]
                                                        },
                                                        "combinator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "and",
                                                            "or"
                                                          ]
                                                        },
                                                        "rules": {
                                                          "type": "array",
                                                          "maxItems": 64,
                                                          "items": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "columnId",
                                                                  "operator"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "rule"
                                                                    ]
                                                                  },
                                                                  "columnId": {
                                                                    "type": "string",
                                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                  },
                                                                  "operator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "contains",
                                                                      "not_contains",
                                                                      "starts_with",
                                                                      "ends_with",
                                                                      "is",
                                                                      "is_not",
                                                                      "is_any_of",
                                                                      "is_none_of",
                                                                      "has_any_of",
                                                                      "has_all_of",
                                                                      "has_none_of",
                                                                      "eq",
                                                                      "neq",
                                                                      "gt",
                                                                      "gte",
                                                                      "lt",
                                                                      "lte",
                                                                      "between",
                                                                      "not_between",
                                                                      "is_before",
                                                                      "is_after",
                                                                      "is_on_or_before",
                                                                      "is_on_or_after",
                                                                      "empty",
                                                                      "not_empty"
                                                                    ]
                                                                  },
                                                                  "value": {
                                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 100
                                                                  },
                                                                  "negated": {
                                                                    "type": "boolean",
                                                                    "enum": [
                                                                      true
                                                                    ],
                                                                    "description": "The rule matches the rows its condition does not."
                                                                  },
                                                                  "withheld": {
                                                                    "type": "boolean",
                                                                    "enum": [
                                                                      true
                                                                    ],
                                                                    "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                  }
                                                                }
                                                              },
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "combinator",
                                                                  "rules"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "group"
                                                                    ]
                                                                  },
                                                                  "combinator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "and",
                                                                      "or"
                                                                    ]
                                                                  },
                                                                  "rules": {
                                                                    "type": "array",
                                                                    "maxItems": 64,
                                                                    "items": {
                                                                      "oneOf": [
                                                                        {
                                                                          "type": "object",
                                                                          "additionalProperties": false,
                                                                          "required": [
                                                                            "type",
                                                                            "columnId",
                                                                            "operator"
                                                                          ],
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "rule"
                                                                              ]
                                                                            },
                                                                            "columnId": {
                                                                              "type": "string",
                                                                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                            },
                                                                            "operator": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "contains",
                                                                                "not_contains",
                                                                                "starts_with",
                                                                                "ends_with",
                                                                                "is",
                                                                                "is_not",
                                                                                "is_any_of",
                                                                                "is_none_of",
                                                                                "has_any_of",
                                                                                "has_all_of",
                                                                                "has_none_of",
                                                                                "eq",
                                                                                "neq",
                                                                                "gt",
                                                                                "gte",
                                                                                "lt",
                                                                                "lte",
                                                                                "between",
                                                                                "not_between",
                                                                                "is_before",
                                                                                "is_after",
                                                                                "is_on_or_before",
                                                                                "is_on_or_after",
                                                                                "empty",
                                                                                "not_empty"
                                                                              ]
                                                                            },
                                                                            "value": {
                                                                              "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                            },
                                                                            "id": {
                                                                              "type": "string",
                                                                              "minLength": 1,
                                                                              "maxLength": 100
                                                                            },
                                                                            "negated": {
                                                                              "type": "boolean",
                                                                              "enum": [
                                                                                true
                                                                              ],
                                                                              "description": "The rule matches the rows its condition does not."
                                                                            },
                                                                            "withheld": {
                                                                              "type": "boolean",
                                                                              "enum": [
                                                                                true
                                                                              ],
                                                                              "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                            }
                                                                          }
                                                                        },
                                                                        {
                                                                          "type": "object",
                                                                          "additionalProperties": false,
                                                                          "required": [
                                                                            "type",
                                                                            "combinator",
                                                                            "rules"
                                                                          ],
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "group"
                                                                              ]
                                                                            },
                                                                            "combinator": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "and",
                                                                                "or"
                                                                              ]
                                                                            },
                                                                            "rules": {
                                                                              "type": "array",
                                                                              "maxItems": 0
                                                                            },
                                                                            "id": {
                                                                              "type": "string",
                                                                              "minLength": 1,
                                                                              "maxLength": 100
                                                                            }
                                                                          }
                                                                        }
                                                                      ]
                                                                    }
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 100
                                                                  }
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 100
                                                        }
                                                      }
                                                    }
                                                  ]
                                                }
                                              },
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 100
                                              }
                                            }
                                          }
                                        ]
                                      }
                                    },
                                    "id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 100
                                    }
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "density": {
                              "type": "string",
                              "enum": [
                                "compact",
                                "comfortable"
                              ]
                            }
                          }
                        },
                        "permissions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "canEdit",
                            "canArchive",
                            "canRestore",
                            "canSetJobDefault"
                          ],
                          "properties": {
                            "canEdit": {
                              "type": "boolean"
                            },
                            "canArchive": {
                              "type": "boolean"
                            },
                            "canRestore": {
                              "type": "boolean"
                            },
                            "canSetJobDefault": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "schemaEtag": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_PATH (viewId)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or view not found (another member’s PERSONAL view is indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Read budget spent, two People table reads already in flight for this key, or the server at its People table read capacity (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "READ_TIMEOUT: the read passed its database bound (10 s a statement, 15 s in all); narrow the request or retry after Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "jobs"
        ],
        "summary": "Update a job People table view",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.views.update`). Replaces the config and, when given, the name at `expectedVersion`. Only the view’s creator, or an organization owner for an ORGANIZATION view, may update it; a built-in view, or a view the caller can open but not manage, is `403` VIEW_NOT_EDITABLE. New terms are checked as on create; a sort already in the stored view is kept as sent. A withheld rule is kept by sending it back as read or removed by listing its id in `removeWithheldRuleIds`; a withheld rule the request neither sends nor removes is `400` VIEW_NOT_APPLICABLE, so an update never drops a rule its caller cannot see.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "viewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedVersion",
                  "config"
                ],
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "\\S",
                    "description": "1–64 characters with at least one that is not a space; trimmed, not \"All People\", and unique among the active views of its scope, ignoring case."
                  },
                  "config": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "columnOrder",
                      "columnVisibility",
                      "columnPinning",
                      "columnSizing",
                      "sort",
                      "filter",
                      "density"
                    ],
                    "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                    "properties": {
                      "columnOrder": {
                        "type": "array",
                        "maxItems": 256,
                        "items": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        }
                      },
                      "columnVisibility": {
                        "type": "object",
                        "maxProperties": 256,
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        },
                        "additionalProperties": {
                          "type": "boolean"
                        }
                      },
                      "columnPinning": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "start",
                          "end"
                        ],
                        "properties": {
                          "start": {
                            "type": "array",
                            "maxItems": 256,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                            }
                          },
                          "end": {
                            "type": "array",
                            "maxItems": 256,
                            "items": {
                              "type": "string",
                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                            }
                          }
                        }
                      },
                      "columnSizing": {
                        "type": "object",
                        "maxProperties": 256,
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                        },
                        "additionalProperties": {
                          "type": "integer",
                          "minimum": 72,
                          "maximum": 800
                        }
                      },
                      "sort": {
                        "type": "array",
                        "maxItems": 5,
                        "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "columnId",
                            "direction"
                          ],
                          "properties": {
                            "columnId": {
                              "type": "string",
                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                            },
                            "direction": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          }
                        }
                      },
                      "filter": {
                        "oneOf": [
                          {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "combinator",
                              "rules"
                            ],
                            "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "group"
                                ]
                              },
                              "combinator": {
                                "type": "string",
                                "enum": [
                                  "and",
                                  "or"
                                ]
                              },
                              "rules": {
                                "type": "array",
                                "maxItems": 64,
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "type",
                                        "columnId",
                                        "operator"
                                      ],
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "rule"
                                          ]
                                        },
                                        "columnId": {
                                          "type": "string",
                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                        },
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "contains",
                                            "not_contains",
                                            "starts_with",
                                            "ends_with",
                                            "is",
                                            "is_not",
                                            "is_any_of",
                                            "is_none_of",
                                            "has_any_of",
                                            "has_all_of",
                                            "has_none_of",
                                            "eq",
                                            "neq",
                                            "gt",
                                            "gte",
                                            "lt",
                                            "lte",
                                            "between",
                                            "not_between",
                                            "is_before",
                                            "is_after",
                                            "is_on_or_before",
                                            "is_on_or_after",
                                            "empty",
                                            "not_empty"
                                          ]
                                        },
                                        "value": {
                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                        },
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 100
                                        },
                                        "negated": {
                                          "type": "boolean",
                                          "enum": [
                                            true
                                          ],
                                          "description": "The rule matches the rows its condition does not."
                                        },
                                        "withheld": {
                                          "type": "boolean",
                                          "enum": [
                                            true
                                          ],
                                          "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "type",
                                        "combinator",
                                        "rules"
                                      ],
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "group"
                                          ]
                                        },
                                        "combinator": {
                                          "type": "string",
                                          "enum": [
                                            "and",
                                            "or"
                                          ]
                                        },
                                        "rules": {
                                          "type": "array",
                                          "maxItems": 64,
                                          "items": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "required": [
                                                  "type",
                                                  "columnId",
                                                  "operator"
                                                ],
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "rule"
                                                    ]
                                                  },
                                                  "columnId": {
                                                    "type": "string",
                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                  },
                                                  "operator": {
                                                    "type": "string",
                                                    "enum": [
                                                      "contains",
                                                      "not_contains",
                                                      "starts_with",
                                                      "ends_with",
                                                      "is",
                                                      "is_not",
                                                      "is_any_of",
                                                      "is_none_of",
                                                      "has_any_of",
                                                      "has_all_of",
                                                      "has_none_of",
                                                      "eq",
                                                      "neq",
                                                      "gt",
                                                      "gte",
                                                      "lt",
                                                      "lte",
                                                      "between",
                                                      "not_between",
                                                      "is_before",
                                                      "is_after",
                                                      "is_on_or_before",
                                                      "is_on_or_after",
                                                      "empty",
                                                      "not_empty"
                                                    ]
                                                  },
                                                  "value": {
                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                  },
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 100
                                                  },
                                                  "negated": {
                                                    "type": "boolean",
                                                    "enum": [
                                                      true
                                                    ],
                                                    "description": "The rule matches the rows its condition does not."
                                                  },
                                                  "withheld": {
                                                    "type": "boolean",
                                                    "enum": [
                                                      true
                                                    ],
                                                    "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                  }
                                                }
                                              },
                                              {
                                                "type": "object",
                                                "additionalProperties": false,
                                                "required": [
                                                  "type",
                                                  "combinator",
                                                  "rules"
                                                ],
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "group"
                                                    ]
                                                  },
                                                  "combinator": {
                                                    "type": "string",
                                                    "enum": [
                                                      "and",
                                                      "or"
                                                    ]
                                                  },
                                                  "rules": {
                                                    "type": "array",
                                                    "maxItems": 64,
                                                    "items": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "additionalProperties": false,
                                                          "required": [
                                                            "type",
                                                            "columnId",
                                                            "operator"
                                                          ],
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "enum": [
                                                                "rule"
                                                              ]
                                                            },
                                                            "columnId": {
                                                              "type": "string",
                                                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                            },
                                                            "operator": {
                                                              "type": "string",
                                                              "enum": [
                                                                "contains",
                                                                "not_contains",
                                                                "starts_with",
                                                                "ends_with",
                                                                "is",
                                                                "is_not",
                                                                "is_any_of",
                                                                "is_none_of",
                                                                "has_any_of",
                                                                "has_all_of",
                                                                "has_none_of",
                                                                "eq",
                                                                "neq",
                                                                "gt",
                                                                "gte",
                                                                "lt",
                                                                "lte",
                                                                "between",
                                                                "not_between",
                                                                "is_before",
                                                                "is_after",
                                                                "is_on_or_before",
                                                                "is_on_or_after",
                                                                "empty",
                                                                "not_empty"
                                                              ]
                                                            },
                                                            "value": {
                                                              "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                            },
                                                            "id": {
                                                              "type": "string",
                                                              "minLength": 1,
                                                              "maxLength": 100
                                                            },
                                                            "negated": {
                                                              "type": "boolean",
                                                              "enum": [
                                                                true
                                                              ],
                                                              "description": "The rule matches the rows its condition does not."
                                                            },
                                                            "withheld": {
                                                              "type": "boolean",
                                                              "enum": [
                                                                true
                                                              ],
                                                              "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                            }
                                                          }
                                                        },
                                                        {
                                                          "type": "object",
                                                          "additionalProperties": false,
                                                          "required": [
                                                            "type",
                                                            "combinator",
                                                            "rules"
                                                          ],
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "enum": [
                                                                "group"
                                                              ]
                                                            },
                                                            "combinator": {
                                                              "type": "string",
                                                              "enum": [
                                                                "and",
                                                                "or"
                                                              ]
                                                            },
                                                            "rules": {
                                                              "type": "array",
                                                              "maxItems": 64,
                                                              "items": {
                                                                "oneOf": [
                                                                  {
                                                                    "type": "object",
                                                                    "additionalProperties": false,
                                                                    "required": [
                                                                      "type",
                                                                      "columnId",
                                                                      "operator"
                                                                    ],
                                                                    "properties": {
                                                                      "type": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "rule"
                                                                        ]
                                                                      },
                                                                      "columnId": {
                                                                        "type": "string",
                                                                        "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                      },
                                                                      "operator": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "contains",
                                                                          "not_contains",
                                                                          "starts_with",
                                                                          "ends_with",
                                                                          "is",
                                                                          "is_not",
                                                                          "is_any_of",
                                                                          "is_none_of",
                                                                          "has_any_of",
                                                                          "has_all_of",
                                                                          "has_none_of",
                                                                          "eq",
                                                                          "neq",
                                                                          "gt",
                                                                          "gte",
                                                                          "lt",
                                                                          "lte",
                                                                          "between",
                                                                          "not_between",
                                                                          "is_before",
                                                                          "is_after",
                                                                          "is_on_or_before",
                                                                          "is_on_or_after",
                                                                          "empty",
                                                                          "not_empty"
                                                                        ]
                                                                      },
                                                                      "value": {
                                                                        "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                      },
                                                                      "id": {
                                                                        "type": "string",
                                                                        "minLength": 1,
                                                                        "maxLength": 100
                                                                      },
                                                                      "negated": {
                                                                        "type": "boolean",
                                                                        "enum": [
                                                                          true
                                                                        ],
                                                                        "description": "The rule matches the rows its condition does not."
                                                                      },
                                                                      "withheld": {
                                                                        "type": "boolean",
                                                                        "enum": [
                                                                          true
                                                                        ],
                                                                        "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                      }
                                                                    }
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "additionalProperties": false,
                                                                    "required": [
                                                                      "type",
                                                                      "combinator",
                                                                      "rules"
                                                                    ],
                                                                    "properties": {
                                                                      "type": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "group"
                                                                        ]
                                                                      },
                                                                      "combinator": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                          "and",
                                                                          "or"
                                                                        ]
                                                                      },
                                                                      "rules": {
                                                                        "type": "array",
                                                                        "maxItems": 0
                                                                      },
                                                                      "id": {
                                                                        "type": "string",
                                                                        "minLength": 1,
                                                                        "maxLength": 100
                                                                      }
                                                                    }
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "id": {
                                                              "type": "string",
                                                              "minLength": 1,
                                                              "maxLength": 100
                                                            }
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 100
                                                  }
                                                }
                                              }
                                            ]
                                          }
                                        },
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 100
                                        }
                                      }
                                    }
                                  ]
                                }
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "density": {
                        "type": "string",
                        "enum": [
                          "compact",
                          "comfortable"
                        ]
                      }
                    }
                  },
                  "removeWithheldRuleIds": {
                    "type": "array",
                    "maxItems": 32,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "description": "Ids of withheld rules to remove from the stored filter."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "View updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "view",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "view": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "name",
                        "scope",
                        "version",
                        "archivedAt",
                        "config",
                        "permissions"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "BUILT_IN",
                            "PERSONAL",
                            "ORGANIZATION"
                          ]
                        },
                        "version": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "archivedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "config": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "columnOrder",
                            "columnVisibility",
                            "columnPinning",
                            "columnSizing",
                            "sort",
                            "filter",
                            "density"
                          ],
                          "description": "A view configuration over describe column ids. Visibility, order, pinning and sizing may name any classified column; ids of archived or unknown columns are dropped.",
                          "properties": {
                            "columnOrder": {
                              "type": "array",
                              "maxItems": 256,
                              "items": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              }
                            },
                            "columnVisibility": {
                              "type": "object",
                              "maxProperties": 256,
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "additionalProperties": {
                                "type": "boolean"
                              }
                            },
                            "columnPinning": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "start",
                                "end"
                              ],
                              "properties": {
                                "start": {
                                  "type": "array",
                                  "maxItems": 256,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  }
                                },
                                "end": {
                                  "type": "array",
                                  "maxItems": 256,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  }
                                }
                              }
                            },
                            "columnSizing": {
                              "type": "object",
                              "maxProperties": 256,
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                              },
                              "additionalProperties": {
                                "type": "integer",
                                "minimum": 72,
                                "maximum": 800
                              }
                            },
                            "sort": {
                              "type": "array",
                              "maxItems": 5,
                              "description": "At most 5 (LIMIT_EXCEEDED). On a write, each on a column this key can sort, or already in the stored view.",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "columnId",
                                  "direction"
                                ],
                                "properties": {
                                  "columnId": {
                                    "type": "string",
                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                  },
                                  "direction": {
                                    "type": "string",
                                    "enum": [
                                      "asc",
                                      "desc"
                                    ]
                                  }
                                }
                              }
                            },
                            "filter": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "type",
                                    "combinator",
                                    "rules"
                                  ],
                                  "description": "A filter group over column ids (not web paths). Up to 32 rules, nested at most 4 deep.",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "group"
                                      ]
                                    },
                                    "combinator": {
                                      "type": "string",
                                      "enum": [
                                        "and",
                                        "or"
                                      ]
                                    },
                                    "rules": {
                                      "type": "array",
                                      "maxItems": 64,
                                      "items": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "columnId",
                                              "operator"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "rule"
                                                ]
                                              },
                                              "columnId": {
                                                "type": "string",
                                                "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                              },
                                              "operator": {
                                                "type": "string",
                                                "enum": [
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "is",
                                                  "is_not",
                                                  "is_any_of",
                                                  "is_none_of",
                                                  "has_any_of",
                                                  "has_all_of",
                                                  "has_none_of",
                                                  "eq",
                                                  "neq",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "between",
                                                  "not_between",
                                                  "is_before",
                                                  "is_after",
                                                  "is_on_or_before",
                                                  "is_on_or_after",
                                                  "empty",
                                                  "not_empty"
                                                ]
                                              },
                                              "value": {
                                                "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                              },
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 100
                                              },
                                              "negated": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "The rule matches the rows its condition does not."
                                              },
                                              "withheld": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                              }
                                            }
                                          },
                                          {
                                            "type": "object",
                                            "additionalProperties": false,
                                            "required": [
                                              "type",
                                              "combinator",
                                              "rules"
                                            ],
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "group"
                                                ]
                                              },
                                              "combinator": {
                                                "type": "string",
                                                "enum": [
                                                  "and",
                                                  "or"
                                                ]
                                              },
                                              "rules": {
                                                "type": "array",
                                                "maxItems": 64,
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "columnId",
                                                        "operator"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "rule"
                                                          ]
                                                        },
                                                        "columnId": {
                                                          "type": "string",
                                                          "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                        },
                                                        "operator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "contains",
                                                            "not_contains",
                                                            "starts_with",
                                                            "ends_with",
                                                            "is",
                                                            "is_not",
                                                            "is_any_of",
                                                            "is_none_of",
                                                            "has_any_of",
                                                            "has_all_of",
                                                            "has_none_of",
                                                            "eq",
                                                            "neq",
                                                            "gt",
                                                            "gte",
                                                            "lt",
                                                            "lte",
                                                            "between",
                                                            "not_between",
                                                            "is_before",
                                                            "is_after",
                                                            "is_on_or_before",
                                                            "is_on_or_after",
                                                            "empty",
                                                            "not_empty"
                                                          ]
                                                        },
                                                        "value": {
                                                          "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 100
                                                        },
                                                        "negated": {
                                                          "type": "boolean",
                                                          "enum": [
                                                            true
                                                          ],
                                                          "description": "The rule matches the rows its condition does not."
                                                        },
                                                        "withheld": {
                                                          "type": "boolean",
                                                          "enum": [
                                                            true
                                                          ],
                                                          "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                        }
                                                      }
                                                    },
                                                    {
                                                      "type": "object",
                                                      "additionalProperties": false,
                                                      "required": [
                                                        "type",
                                                        "combinator",
                                                        "rules"
                                                      ],
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "group"
                                                          ]
                                                        },
                                                        "combinator": {
                                                          "type": "string",
                                                          "enum": [
                                                            "and",
                                                            "or"
                                                          ]
                                                        },
                                                        "rules": {
                                                          "type": "array",
                                                          "maxItems": 64,
                                                          "items": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "columnId",
                                                                  "operator"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "rule"
                                                                    ]
                                                                  },
                                                                  "columnId": {
                                                                    "type": "string",
                                                                    "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                  },
                                                                  "operator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "contains",
                                                                      "not_contains",
                                                                      "starts_with",
                                                                      "ends_with",
                                                                      "is",
                                                                      "is_not",
                                                                      "is_any_of",
                                                                      "is_none_of",
                                                                      "has_any_of",
                                                                      "has_all_of",
                                                                      "has_none_of",
                                                                      "eq",
                                                                      "neq",
                                                                      "gt",
                                                                      "gte",
                                                                      "lt",
                                                                      "lte",
                                                                      "between",
                                                                      "not_between",
                                                                      "is_before",
                                                                      "is_after",
                                                                      "is_on_or_before",
                                                                      "is_on_or_after",
                                                                      "empty",
                                                                      "not_empty"
                                                                    ]
                                                                  },
                                                                  "value": {
                                                                    "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 100
                                                                  },
                                                                  "negated": {
                                                                    "type": "boolean",
                                                                    "enum": [
                                                                      true
                                                                    ],
                                                                    "description": "The rule matches the rows its condition does not."
                                                                  },
                                                                  "withheld": {
                                                                    "type": "boolean",
                                                                    "enum": [
                                                                      true
                                                                    ],
                                                                    "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                  }
                                                                }
                                                              },
                                                              {
                                                                "type": "object",
                                                                "additionalProperties": false,
                                                                "required": [
                                                                  "type",
                                                                  "combinator",
                                                                  "rules"
                                                                ],
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "group"
                                                                    ]
                                                                  },
                                                                  "combinator": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "and",
                                                                      "or"
                                                                    ]
                                                                  },
                                                                  "rules": {
                                                                    "type": "array",
                                                                    "maxItems": 64,
                                                                    "items": {
                                                                      "oneOf": [
                                                                        {
                                                                          "type": "object",
                                                                          "additionalProperties": false,
                                                                          "required": [
                                                                            "type",
                                                                            "columnId",
                                                                            "operator"
                                                                          ],
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "rule"
                                                                              ]
                                                                            },
                                                                            "columnId": {
                                                                              "type": "string",
                                                                              "pattern": "^(?:[a-z][a-z0-9_]{0,63}|custom:[A-Za-z0-9_-]{1,64})$"
                                                                            },
                                                                            "operator": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "contains",
                                                                                "not_contains",
                                                                                "starts_with",
                                                                                "ends_with",
                                                                                "is",
                                                                                "is_not",
                                                                                "is_any_of",
                                                                                "is_none_of",
                                                                                "has_any_of",
                                                                                "has_all_of",
                                                                                "has_none_of",
                                                                                "eq",
                                                                                "neq",
                                                                                "gt",
                                                                                "gte",
                                                                                "lt",
                                                                                "lte",
                                                                                "between",
                                                                                "not_between",
                                                                                "is_before",
                                                                                "is_after",
                                                                                "is_on_or_before",
                                                                                "is_on_or_after",
                                                                                "empty",
                                                                                "not_empty"
                                                                              ]
                                                                            },
                                                                            "value": {
                                                                              "description": "text: string; number: number, or [min, max] for (not_)between, on the scale the cells show (ai_interview_score is 0–10, so \"70 or more\" is gte 7); select: string, or string[] for is_any_of/is_none_of; multiselect: string[]; boolean: boolean; date: an ISO date or { relative: { unit, offset } }. Select and multiselect values are the labels the cells show (Canada, High), not ids. empty/not_empty take no value."
                                                                            },
                                                                            "id": {
                                                                              "type": "string",
                                                                              "minLength": 1,
                                                                              "maxLength": 100
                                                                            },
                                                                            "negated": {
                                                                              "type": "boolean",
                                                                              "enum": [
                                                                                true
                                                                              ],
                                                                              "description": "The rule matches the rows its condition does not."
                                                                            },
                                                                            "withheld": {
                                                                              "type": "boolean",
                                                                              "enum": [
                                                                                true
                                                                              ],
                                                                              "description": "The rule is on a column this key cannot query, or on person: its value is not shown. Send it back as read to keep it, or list its id in removeWithheldRuleIds."
                                                                            }
                                                                          }
                                                                        },
                                                                        {
                                                                          "type": "object",
                                                                          "additionalProperties": false,
                                                                          "required": [
                                                                            "type",
                                                                            "combinator",
                                                                            "rules"
                                                                          ],
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "group"
                                                                              ]
                                                                            },
                                                                            "combinator": {
                                                                              "type": "string",
                                                                              "enum": [
                                                                                "and",
                                                                                "or"
                                                                              ]
                                                                            },
                                                                            "rules": {
                                                                              "type": "array",
                                                                              "maxItems": 0
                                                                            },
                                                                            "id": {
                                                                              "type": "string",
                                                                              "minLength": 1,
                                                                              "maxLength": 100
                                                                            }
                                                                          }
                                                                        }
                                                                      ]
                                                                    }
                                                                  },
                                                                  "id": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 100
                                                                  }
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "id": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 100
                                                        }
                                                      }
                                                    }
                                                  ]
                                                }
                                              },
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 100
                                              }
                                            }
                                          }
                                        ]
                                      }
                                    },
                                    "id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 100
                                    }
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "density": {
                              "type": "string",
                              "enum": [
                                "compact",
                                "comfortable"
                              ]
                            }
                          }
                        },
                        "permissions": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "canEdit",
                            "canArchive",
                            "canRestore",
                            "canSetJobDefault"
                          ],
                          "properties": {
                            "canEdit": {
                              "type": "boolean"
                            },
                            "canArchive": {
                              "type": "boolean"
                            },
                            "canRestore": {
                              "type": "boolean"
                            },
                            "canSetJobDefault": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, INVALID_PATH, VALIDATION, COLUMN_NOT_QUERYABLE, INVALID_FILTER, LIMIT_EXCEEDED, VIEW_NOT_APPLICABLE or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, surface not enabled, or VIEW_NOT_EDITABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or view not found (another member’s PERSONAL view is indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH, IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/views/{viewId}/archive": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Archive a job People table view",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.views.archive`). Archives the view at `expectedVersion`. Every personal default and last opened view that named it, and the job default when it named it, are cleared (the web’s rule). Archiving an archived view answers its version and writes nothing. Only the view’s creator, or an organization owner for an ORGANIZATION view, may archive it (`403` VIEW_NOT_EDITABLE).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "viewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedVersion"
                ],
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "View archived",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "viewId",
                    "archived",
                    "version",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "viewId": {
                      "type": "string"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, INVALID_PATH, VALIDATION or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, surface not enabled, or VIEW_NOT_EDITABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or view not found (another member’s PERSONAL view is indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH, IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/views/{viewId}/restore": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Restore a job People table view",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.views.restore`). Restores an archived view at `expectedVersion`. A restore whose name an active view of its scope now uses is `400` VALIDATION. Restoring an active view answers its version and writes nothing. Only the view’s creator, or an organization owner for an ORGANIZATION view, may restore it (`403` VIEW_NOT_EDITABLE).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "viewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedVersion"
                ],
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "View restored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "viewId",
                    "archived",
                    "version",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "viewId": {
                      "type": "string"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, INVALID_PATH, VALIDATION or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, surface not enabled, or VIEW_NOT_EDITABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or view not found (another member’s PERSONAL view is indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "VERSION_MISMATCH, IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/preferences": {
      "put": {
        "tags": [
          "jobs"
        ],
        "summary": "Set your own default and last opened People table view for a job",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.preferences.set`). The caller’s own preferences only. An omitted field is kept; null or a built-in view id resets it. A view id must name an active view the caller can open (`404` otherwise). Answers the caller’s defaults after the write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "description": "An omitted field is kept; null or a built-in view id resets it. A view id must name a view the caller can open.",
                "properties": {
                  "defaultViewId": {
                    "oneOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "pattern": "^[!-~]+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lastOpenedViewId": {
                    "oneOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "pattern": "^[!-~]+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preferences set",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "defaults",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "defaults": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "personalDefaultViewId",
                        "jobDefaultViewId",
                        "lastOpenedViewId",
                        "resolvedViewId"
                      ],
                      "description": "Stored view preferences and the job default; each id names a view in views, or is null. resolvedViewId is the view a rows query without viewId applies.",
                      "properties": {
                        "personalDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "jobDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lastOpenedViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "resolvedViewId": {
                          "type": "string"
                        }
                      }
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, VALIDATION or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or view not found (another member’s PERSONAL view is indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/job-default-view": {
      "put": {
        "tags": [
          "jobs"
        ],
        "summary": "Set the job default People table view",
        "description": "Requires `people_table:write`, a claimed account, the `people_table` agent surface, a verified user and employer access to the job (`people_table.job_default_view.set`). Organization owners only (`403` JOB_DEFAULT_REQUIRES_OWNER). The view must be an active ORGANIZATION view (`400` JOB_DEFAULT_REQUIRES_ORGANIZATION_VIEW); null clears the job default. Answers the caller’s defaults after the write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "viewId"
                ],
                "properties": {
                  "viewId": {
                    "oneOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "pattern": "^[!-~]+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Job default set",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "defaults",
                    "batchId",
                    "requestId",
                    "replayed",
                    "dryRun"
                  ],
                  "properties": {
                    "defaults": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "personalDefaultViewId",
                        "jobDefaultViewId",
                        "lastOpenedViewId",
                        "resolvedViewId"
                      ],
                      "description": "Stored view preferences and the job default; each id names a view in views, or is null. resolvedViewId is the view a rows query without viewId applies.",
                      "properties": {
                        "personalDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "jobDefaultViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lastOpenedViewId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "resolvedViewId": {
                          "type": "string"
                        }
                      }
                    },
                    "batchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The idempotency receipt id; every audit event of this request carries it. Null on a dryRun."
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "INVALID_BODY, VALIDATION, JOB_DEFAULT_REQUIRES_ORGANIZATION_VIEW or IDEMPOTENCY_KEY_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, unclaimed account, unverified user, surface not enabled, or JOB_DEFAULT_REQUIRES_OWNER",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or view not found (another member’s PERSONAL view is indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "IDEMPOTENCY_KEY_REUSED or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Write budget spent (RATE_LIMITED, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Writes temporarily unavailable (WRITES_UNAVAILABLE, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/people/rows/{jobPersonId}/agent-notes/history": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Page one person’s Agent notes revision history",
        "description": "Requires `people_table:read` and employer access to the job (`people_table.agent_notes.history`). Newest-first revision metadata: version, action, actor + kind, surface, request id, idempotency key, reason, before/after hashes, size and the bounded source references. Revision CONTENT (the body after each revision and the appended text) is separately authorized: `includeContent=true` requires `people_table:write`; without it `content` is null and `contentIncluded` false. An unknown cursor is a `400` INVALID_CURSOR.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "jobPersonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "description": "Opaque cursor from the previous page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "includeContent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Return each revision’s body (and appended text). Separately authorized: requires `people_table:write`."
          }
        ],
        "responses": {
          "200": {
            "description": "Revision page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "jobPersonId",
                    "revisions",
                    "nextCursor",
                    "contentIncluded"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "jobPersonId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "revisions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "version",
                          "action",
                          "createdAt",
                          "actor",
                          "surface",
                          "requestId",
                          "idempotencyKey",
                          "reason",
                          "beforeEtag",
                          "afterEtag",
                          "sizeChars",
                          "sourceReferences",
                          "content"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "action": {
                            "type": "string",
                            "enum": [
                              "CREATE",
                              "APPEND",
                              "REPLACE",
                              "ARCHIVE"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "actor": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "userId",
                              "kind"
                            ],
                            "properties": {
                              "userId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "USER",
                                  "AGENT",
                                  "SYSTEM"
                                ]
                              }
                            }
                          },
                          "surface": {
                            "type": "string",
                            "enum": [
                              "WEB",
                              "API"
                            ]
                          },
                          "requestId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "idempotencyKey": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 500
                          },
                          "beforeEtag": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "afterEtag": {
                            "type": "string"
                          },
                          "sizeChars": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "sourceReferences": {
                            "type": "array",
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "kind",
                                "id"
                              ],
                              "description": "One bounded source reference. Every kind but `manual` names a record that must belong to this job AND this person; anything else is refused without saying whether it exists.",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "proposal",
                                    "conversation",
                                    "message",
                                    "interview",
                                    "assessment",
                                    "contract",
                                    "project_todo",
                                    "training",
                                    "manual"
                                  ]
                                },
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 64,
                                  "description": "Null only for `manual`."
                                }
                              }
                            }
                          },
                          "content": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "bodyMarkdown",
                                  "appendedMarkdown"
                                ],
                                "properties": {
                                  "bodyMarkdown": {
                                    "type": "string",
                                    "maxLength": 32000,
                                    "description": "The whole document as it stood after this revision."
                                  },
                                  "appendedMarkdown": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "maxLength": 8000,
                                    "description": "For APPEND: exactly what was added; null otherwise."
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Present only when revision content was requested AND authorized."
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contentIncluded": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or INVALID_CURSOR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (includeContent needs people_table:write), unclaimed account, or surface not enabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or job person not found (foreign ones are indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/close": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Close (archive) a published job",
        "description": "Requires `jobs:write` + the `public_api_job_publishing` feature. Removes the job from public listing and stops new proposals. Idempotent: closing an already-closed job returns `alreadyClosed: true`. Existing contracts are unaffected.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Close outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "jobId",
                    "status",
                    "alreadyClosed"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "ARCHIVED"
                      ]
                    },
                    "alreadyClosed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or not your job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/publish": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Publish a draft job to the marketplace",
        "description": "Requires `jobs:write` + the `public_api_job_publishing` feature. Runs the same validation/moderation pipeline as the web flow; per-account daily limits apply. `applicationScreening` says whether applicants take a screening course (DEV-4490).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Publish outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "applicationScreening": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Whether applicants take a screening course and quiz before hire (the job’s ACTIVE SCREENING course link). Proposals submitted before the link are not enrolled automatically, so link it before publishing (`POST /lms/jobs/{jobId}/courses/link` with stage SCREENING); `GET /lms/jobs/{jobId}/screening` lists earlier proposals as bindingGaps. `nextCommands` are CLI commands. Null when the read failed; the draft or publish itself still succeeded.",
                      "additionalProperties": false,
                      "required": [
                        "linked",
                        "courseId",
                        "courseTitle",
                        "maxAttempts",
                        "note",
                        "nextCommands"
                      ],
                      "properties": {
                        "linked": {
                          "type": "boolean"
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "courseTitle": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "maxAttempts": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Applicant quiz attempt ceiling; null reads as the platform default (1)."
                        },
                        "note": {
                          "type": "string"
                        },
                        "nextCommands": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Draft not publish-ready (validation details included)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/invites": {
      "get": {
        "tags": [
          "proposals"
        ],
        "summary": "List invitation state for one owned job (pageable)",
        "description": "DEV-2846 — `proposal_management.job_invitations.list`. Requires `proposals:read`, the hiring feature, and employer access to the job (checked BEFORE the read; unknown/foreign jobs are 404/403), inside the DEFAULT-OFF `proposal_management` agent-surface family (`AGENT_SURFACE_PROPOSAL_MANAGEMENT_ENABLED`; a disabled family is a typed 403 `AGENT_SURFACE_DISABLED` checked before scope and ownership). A `limit` below 1 is a 400. Reads canonical Joboffer INVITE rows only; state is HIRED (accepted linked PROPOSAL) > APPLIED (linked proposal) > DECLINED > EXPIRED > INVITED. EXPIRED (DEV-3285): the job closed, `expiresAt` (30 days after sending) passed, or a newer invitation replaced the row; inviting again after the 30 days on an open job creates a new invitation row. Hidden, banned, or closed candidates are withheld from BOTH the page and `totalCount`. Optional `freelancerId` and `state` filters apply BEFORE the exact count and the newest-first `createdAt`,`id` keyset cursor (never a post-filtered page). Identity is masked: first name + last initial, slug, and country only.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "freelancerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "INVITED",
                "DECLINED",
                "APPLIED",
                "HIRED",
                "EXPIRED"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invitation page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "asOf",
                    "invitations",
                    "nextCursor",
                    "totalCount"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "invitations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PublicApiJobInvitationItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "totalCount": {
                      "type": "integer",
                      "description": "Exact eligible-and-filtered count, independent of the page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid state, cursor, or limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Not your job, insufficient scope, or hiring feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "proposals"
        ],
        "summary": "Invite a freelancer to a job",
        "description": "Requires `proposals:write` + `public_api_hiring` + a claimed account. Idempotent per (job, freelancer) while an invitation is live: a repeat answers 200 with the live invitation (`alreadyInvited: true`), and a worker who already applied gets their proposal echoed the same way. DEV-3285: an invitation expires when the job closes or 30 days after it was sent; inviting again after the 30 days on an open job creates a NEW invitation (201); on a closed job a repeat answers 200 with the current invitation and writes nothing. At most one live invitation exists per job and worker.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "freelancerId"
                ],
                "properties": {
                  "freelancerId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing live invitation or proposal (alreadyInvited: true)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "201": {
            "description": "New invitation (alreadyInvited: false)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, unclaimed account, consent-first recruiting job (`RECRUITING_API_NOT_AVAILABLE`), or a restricted account country",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or freelancer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The job is not published (`job_not_published`), the user is not a freelancer (`not_a_freelancer`), the freelancer is unavailable (`freelancer_unavailable`), or the job takes no invitations (`job_not_accepting_invitations`); `details.reason` carries the value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/invites/{freelancerId}": {
      "get": {
        "tags": [
          "proposals"
        ],
        "summary": "Read invitation state for one job + freelancer",
        "description": "DEV-2846 — `proposal_management.job_invitations.get`. Requires `proposals:read`, the hiring feature, and employer access to the job, inside the DEFAULT-OFF `proposal_management` agent-surface family (`AGENT_SURFACE_PROPOSAL_MANAGEMENT_ENABLED`; a disabled family is a typed 403 `AGENT_SURFACE_DISABLED` checked before scope and ownership). Unknown, hidden, banned, closed, and never-invited candidates ALL read the same uniform `{ invited: false, invitation: null }` (no enumeration signal). A repeated POST invite for the same job + candidate is idempotent on the ORIGINAL INVITE row even after the candidate applied.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "freelancerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invitation lookup",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "freelancerId",
                    "asOf",
                    "invited",
                    "invitation"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "freelancerId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "invited": {
                      "type": "boolean",
                      "description": "False means never invited (withheld profiles also read false)."
                    },
                    "invitation": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PublicApiJobInvitationItem"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Not your job, insufficient scope, or hiring feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/proposals": {
      "get": {
        "tags": [
          "proposals"
        ],
        "summary": "List proposals for an owned job",
        "description": "Requires `proposals:read`. Candidate identity and contact are masked before an unlock or recorded hire. An employer key with explicit `applicant_contact:read` receives `candidate.contact.email` and `candidate.contact.linkedinUrl` only for released applicants; the grant never releases a locked applicant. Every row carries `screening` (the application-stage LMS course + quiz standing: `enrollmentKey`, `status`, `waitingOn`, `courseVersionNumber`, `courseVersionCurrent`, `gradeState`, `earnedPoints`, `possiblePoints`, `percentage`, `passed`, `submittedAt`, `released`; null when the job has no screening course or the proposal is not enrolled) and `screeningRead` (`OK` | `FAILED` — on `FAILED` a null block means unknown right now, not \"not enrolled\"). `sort=screening_score` returns ONE ranked page: highest finalized percentage first, then finalized-but-unscored, then submitted awaiting grades, then open enrollments, then proposals with no enrollment — bounded to the newest 500 proposals, reported at runtime by `ranking { rankedCount, scoredCount, complete }` (`rankedCount` = proposals the ranking covered, scored or not; `scoredCount` = those with a finalized percentage, 0 when nobody is graded yet; `complete: false` = the job exceeds the bound and the top candidate may sit outside the ranked set) and `hasMore` (raise `limit`, up to 500, to see more ranked rows); `cursor` is refused with it, and a failed screening read is a retryable 503 rather than a recency-ordered answer.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "recent",
                "screening_score"
              ]
            },
            "description": "`recent` (default; newest first, cursor-pageable) or `screening_score` (one ranked page by the screening course score; no cursor)."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Proposals page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Recency order only; null for sort=screening_score."
                    },
                    "hasMore": {
                      "type": "boolean",
                      "description": "More proposals exist beyond this page (a next cursor for the recency order; for the screening rank, more ranked rows than limit or a job larger than the ranking bound)."
                    },
                    "ranking": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "sort=screening_score only: rankedCount = proposals the ranking covered (scored or not), scoredCount = those with a finalized screening percentage, complete = whether the ranking covered every proposal on the job.",
                      "properties": {
                        "rankedCount": {
                          "type": "integer"
                        },
                        "scoredCount": {
                          "type": "integer"
                        },
                        "complete": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Not your job or insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "sort=screening_score only: the screening read failed; retryable, or use sort=recent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}": {
      "get": {
        "tags": [
          "proposals"
        ],
        "summary": "Get proposal detail",
        "description": "Requires `proposals:read`. Includes bid, AI-interview summary/score, verification, Open Label attempt, the application-stage `screening` block (LMS course + quiz standing with `enrollmentKey` for the LMS review/grade/release/decide operations) with `screeningRead` (`FAILED` = unknown right now, not \"not enrolled\"), and contract status. Candidate identity and contact are masked before an unlock or recorded hire. An employer key with explicit `applicant_contact:read` receives contact only for a released applicant.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Proposal detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "required": [
                    "proposal"
                  ],
                  "properties": {
                    "proposal": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "verification"
                      ],
                      "properties": {
                        "verification": {
                          "type": "object",
                          "description": "Identity (shared DEV-2922 verdict), proposal-time location snapshot, current location, and project eligibility — separately scoped.",
                          "additionalProperties": false,
                          "required": [
                            "location",
                            "identity",
                            "currentLocation",
                            "projectEligibility"
                          ],
                          "properties": {
                            "location": {
                              "$ref": "#/components/schemas/CandidateProposalTimeLocation"
                            },
                            "identity": {
                              "$ref": "#/components/schemas/CandidateIdentityVerdict"
                            },
                            "currentLocation": {
                              "$ref": "#/components/schemas/CandidateCurrentLocation"
                            },
                            "projectEligibility": {
                              "$ref": "#/components/schemas/CandidateProjectEligibility"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Not your proposal or insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/interview": {
      "get": {
        "tags": [
          "proposals"
        ],
        "summary": "Get the AI-interview transcript for a proposal",
        "description": "Requires `proposals:read`. Sanitized transcript of the screening interview. `interview.audio` reports whether the full voice recording can be fetched from `/proposals/{proposalId}/interview/recording` (`available`, `status`, `modality`, `durationSeconds`) from stored metadata, without signing anything.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Interview transcript",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "interview": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "audio": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "available",
                            "status",
                            "modality",
                            "durationSeconds"
                          ],
                          "properties": {
                            "available": {
                              "type": "boolean"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "AVAILABLE",
                                "NO_AUDIO_TEXT_MODALITY",
                                "CONSENT_REQUIRED",
                                "PROCESSING",
                                "RECORDING_REMOVED",
                                "NOT_AVAILABLE"
                              ]
                            },
                            "modality": {
                              "type": "string",
                              "enum": [
                                "VOICE",
                                "TEXT"
                              ]
                            },
                            "durationSeconds": {
                              "type": [
                                "number",
                                "null"
                              ]
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Proposal or transcript not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/interview/recording": {
      "get": {
        "tags": [
          "proposals"
        ],
        "operationId": "getProposalInterviewRecording",
        "summary": "Get the full AI voice-interview recording for a proposal (signed URLs)",
        "description": "DEV-4498. Requires `proposals:read` and the same proposal ownership as the transcript (foreign or unknown proposals are an opaque 404). Returns the WHOLE recording — interviewer and candidate, start to finish — as short-lived signed URL(s) (at most 10 minutes) plus metadata (mime, container, duration, size, recordedAt, consentAt). A normal session is one file (`delivery: SINGLE_FILE`); when the browser recorder restarted mid-interview the recording has several segments in recording order (`delivery: SEGMENTS`) and `concatenation` says whether they can be byte-joined (`BYTE_CONCAT_SAFE` for MP3/Ogg) or must stay separate files (`SEPARATE_FILES` for WebM/MP4 — there is no server-side remux). Released only when the candidate consented to recording (`consentAt`); every admitted attempt is audited append-only before any URL is disclosed. Candidate self-access is a typed 403 `SELF_ACCESS_NOT_SUPPORTED`. Accepted exception on storage identifiers: the signed URLs themselves necessarily embed the provider object path (an opaque `interviews/<interviewId>/<voiceSessionId>/recording-<n>.<ext>` key with no personal data) and are usable only with their token for at most 10 minutes; no storage path, bucket or durable URL appears anywhere else in the response or in audit rows. The segment manifest is read from the interviewer service on every call; when it cannot be read the response is a retryable 503 `RECORDING_MANIFEST_UNAVAILABLE` rather than a partial file presented as the whole interview, and archived (cold-tier) objects are existence-checked before a URL is minted. Typed denials via `details.reason` (every failure also carries `details.requestId`): 404 `NO_AUDIO_TEXT_MODALITY` (text interview), 403 `RECORDING_CONSENT_REQUIRED`, 409 `RECORDING_PROCESSING` (still recording or finalizing; retry later), 404 `RECORDING_NOT_AVAILABLE` (never uploaded, erased, or gone from storage), 404 `RECORDING_REMOVED` (permanently removed), 503 `RECORDING_MANIFEST_UNAVAILABLE` / `RECORDING_SIGNING_FAILED` (retryable). Download the URL(s) with your own HTTP client before `expiresAt`.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Signed recording URL(s) plus metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "recording"
                  ],
                  "properties": {
                    "recording": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "proposalId",
                        "interviewId",
                        "modality",
                        "mimeType",
                        "container",
                        "fileExtension",
                        "durationSeconds",
                        "sizeBytes",
                        "recordedAt",
                        "consentAt",
                        "url",
                        "expiresAt",
                        "segmentCount",
                        "delivery",
                        "concatenation",
                        "segments",
                        "note"
                      ],
                      "properties": {
                        "proposalId": {
                          "type": "string"
                        },
                        "interviewId": {
                          "type": "string"
                        },
                        "modality": {
                          "type": "string",
                          "enum": [
                            "VOICE"
                          ]
                        },
                        "mimeType": {
                          "type": "string",
                          "description": "MIME type of the first segment: audio/webm (Chrome, Firefox, Edge) or audio/mp4 (Safari) as recorded by the browser."
                        },
                        "container": {
                          "type": "string",
                          "enum": [
                            "webm",
                            "mp4",
                            "mpeg",
                            "ogg",
                            "wav",
                            "unknown"
                          ]
                        },
                        "fileExtension": {
                          "type": "string",
                          "description": "Suggested extension for a download (webm, m4a, mp3, ...)."
                        },
                        "durationSeconds": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "sizeBytes": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "recordedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "consentAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "url": {
                          "type": "string",
                          "description": "The whole recording when delivery is SINGLE_FILE; otherwise the first segment."
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "segmentCount": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "delivery": {
                          "type": "string",
                          "enum": [
                            "SINGLE_FILE",
                            "SEGMENTS"
                          ]
                        },
                        "concatenation": {
                          "type": "string",
                          "enum": [
                            "NOT_NEEDED",
                            "BYTE_CONCAT_SAFE",
                            "SEPARATE_FILES"
                          ],
                          "description": "What a client must do with several segments. WebM and MP4 files cannot be byte-joined (each carries a file header) and there is no server-side remux, so multi-segment recordings in those containers are SEPARATE_FILES."
                        },
                        "segments": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "index",
                              "url",
                              "expiresAt",
                              "mimeType",
                              "durationSeconds",
                              "sizeBytes",
                              "recordedAt"
                            ],
                            "properties": {
                              "index": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "0-based position in recording order."
                              },
                              "url": {
                                "type": "string",
                                "description": "Short-lived signed URL (at most 10 minutes). Accepted exception: the URL itself embeds the provider object key (opaque ids only); no storage identifier appears elsewhere."
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "mimeType": {
                                "type": "string"
                              },
                              "durationSeconds": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "sizeBytes": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "recordedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            }
                          }
                        },
                        "note": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Missing `proposals:read`, or the candidate did not consent to recording (`RECORDING_CONSENT_REQUIRED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal not visible, no interview, text interview (`NO_AUDIO_TEXT_MODALITY`), recording removed (`RECORDING_REMOVED`), or no recording (`RECORDING_NOT_AVAILABLE`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Recording still in progress or finalizing (`RECORDING_PROCESSING`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Manifest unreadable or signing failed; retry shortly (`RECORDING_MANIFEST_UNAVAILABLE`, `RECORDING_SIGNING_FAILED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/disposition": {
      "post": {
        "tags": [
          "proposals"
        ],
        "summary": "Decline, maybe, or restore one employer proposal (audited CAS)",
        "description": "Requires `proposals:write`, employer access to the proposal’s job, and the default-off `proposal_management` family (`AGENT_SURFACE_PROPOSAL_MANAGEMENT_ENABLED`). Candidate self-access is NEVER mutation authority. DECLINE → DECLINED; MAYBE → MAYBE; RESTORE returns a DECLINED proposal to its last safe audited prior status (UNREVIEWED/SHORTLISTED/MAYBE) or falls back to UNREVIEWED. HIRED (`PROPOSAL_ALREADY_HIRED`), provider-managed RESUME_SENT (`PROPOSAL_MANAGED_BY_PROVIDER`), active-non-tour-contract (`ACTIVE_CONTRACT_EXISTS`), and lost CAS races (`STALE_PROPOSAL_STATUS`) fail closed as typed 409s. Same idempotency key + payload replays the exact original outcome; a changed payload is a 409 `IDEMPOTENCY_KEY_REUSED`. Every applied transition appends one immutable audit event (`proposal_management.proposals.disposition`).",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "REQUIRED and must exactly equal body.idempotencyKey (typed 400 IDEMPOTENCY_KEY_HEADER_REQUIRED / IDEMPOTENCY_KEY_MISMATCH otherwise)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "action",
                  "expectedStatus",
                  "reasonCode",
                  "idempotencyKey"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "DECLINE",
                      "MAYBE",
                      "RESTORE"
                    ]
                  },
                  "expectedStatus": {
                    "type": "string",
                    "enum": [
                      "UNREVIEWED",
                      "SHORTLISTED",
                      "MAYBE",
                      "DECLINED",
                      "NOT_A_FIT",
                      "HIRED",
                      "RESUME_SENT"
                    ],
                    "description": "CAS pin: the mutation applies only while the row still holds this status. A lost race is a typed 409 STALE_PROPOSAL_STATUS."
                  },
                  "reasonCode": {
                    "type": "string",
                    "enum": [
                      "REQUIREMENTS_MISMATCH",
                      "EXPERIENCE_MISMATCH",
                      "RATE_MISMATCH",
                      "LOCATION_INELIGIBLE",
                      "INTEGRITY_CONCERN",
                      "POSITION_FILLED",
                      "DUPLICATE_PROPOSAL",
                      "EMPLOYER_RECONSIDERATION",
                      "OTHER"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Optional bounded employer-private note. Never candidate-readable."
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Disposition outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "action",
                    "oldStatus",
                    "newStatus",
                    "reasonCode",
                    "note",
                    "actorUserId",
                    "occurredAt",
                    "auditEventId",
                    "replayed"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "action": {
                      "type": "string",
                      "enum": [
                        "DECLINE",
                        "MAYBE",
                        "RESTORE"
                      ]
                    },
                    "oldStatus": {
                      "type": "string"
                    },
                    "newStatus": {
                      "type": "string"
                    },
                    "reasonCode": {
                      "type": "string",
                      "enum": [
                        "REQUIREMENTS_MISMATCH",
                        "EXPERIENCE_MISMATCH",
                        "RATE_MISMATCH",
                        "LOCATION_INELIGIBLE",
                        "INTEGRITY_CONCERN",
                        "POSITION_FILLED",
                        "DUPLICATE_PROPOSAL",
                        "EMPLOYER_RECONSIDERATION",
                        "OTHER"
                      ]
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "actorUserId": {
                      "type": "string"
                    },
                    "occurredAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "auditEventId": {
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when a same-key retry replayed the original stored outcome."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, RESTORE without DECLINED pin, or invalid status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, family disabled, or unclaimed agent account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal not found (foreign/non-proposal rows indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "PROPOSAL_ALREADY_HIRED, PROPOSAL_MANAGED_BY_PROVIDER, ACTIVE_CONTRACT_EXISTS, STALE_PROPOSAL_STATUS, IDEMPOTENCY_KEY_REUSED, or MUTATION_IN_PROGRESS",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/disposition/history": {
      "get": {
        "tags": [
          "proposals"
        ],
        "summary": "Read the append-only disposition audit history of one proposal",
        "description": "Requires `proposals:read`, employer access to the proposal’s job, and the default-off `proposal_management` family. OWNER-ONLY: employer reasons/notes never reach candidates, and the generic candidate-readable proposal GET carries none of these fields. Newest-first bounded page over the immutable ledger (`proposal_management.proposals.disposition_history.list`).",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            },
            "description": "Opaque continuation from a previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "Disposition audit page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "events",
                    "nextCursor",
                    "complete"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "action",
                          "previousStatus",
                          "newStatus",
                          "reasonCode",
                          "note",
                          "actorUserId",
                          "occurredAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "action": {
                            "type": "string",
                            "enum": [
                              "DECLINE",
                              "MAYBE",
                              "RESTORE"
                            ]
                          },
                          "previousStatus": {
                            "type": "string"
                          },
                          "newStatus": {
                            "type": "string"
                          },
                          "reasonCode": {
                            "type": "string",
                            "enum": [
                              "REQUIREMENTS_MISMATCH",
                              "EXPERIENCE_MISMATCH",
                              "RATE_MISMATCH",
                              "LOCATION_INELIGIBLE",
                              "INTEGRITY_CONCERN",
                              "POSITION_FILLED",
                              "DUPLICATE_PROPOSAL",
                              "EMPLOYER_RECONSIDERATION",
                              "OTHER"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "actorUserId": {
                            "type": "string"
                          },
                          "occurredAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "complete": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid/over-length proposal id, unknown or duplicate query parameter, or empty/invalid limit/cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, family disabled, or not your job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal not found (foreign/non-proposal rows indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/dossier": {
      "get": {
        "tags": [
          "candidate-dossier"
        ],
        "summary": "Get the privacy-safe candidate dossier for a proposal",
        "description": "Requires `candidate_dossier:read`, the default-off candidate-dossier agent surface, and a claimed account. Aggregates the masked candidate profile, proposal, AI-interview summary, verification verdicts (incl. the dossier-only identity assurance decomposition and current-location decision detail), factual engagement disposition, neutral candidate links, and review/contract roll-ups with a stable `asOf` timestamp plus explicit availability/missing/redactions/provenance metadata. `evidence=full` (DEV-2923 B3) adds ten bounded metadata-only evidence families. Hidden or banned candidates read as 404. Contract roll-ups and history exclude demo and sample rows (tour fixtures, the docs-demo seed, DEMO_* accounts and the candidate’s Bubble-era onboarding “Sample Job”) with no opt-in (DEV-2924). Never includes raw resume text/files, contact information, government IDs, message bodies/participants, or cross-buyer private assessments. The base proposal summary keeps THIS authorized proposal’s own bid; the full-evidence block and every cross-buyer/history section carry NO compensation amounts, and coordinates/IP/ASN/timezone data never appear anywhere. Candidate-authored free text (profile fields and the AI-interview summary) is sanitized server-side with explicit [REDACTED_EMAIL]/[REDACTED_PHONE]/[REDACTED_PHYSICAL_ADDRESS]/[REDACTED_CONTACT_HANDLE] placeholders, recorded as PRIVACY_MASKED entries in `redactions` (field path + kind + count — never the removed value).",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "evidence",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "concise",
                "full"
              ],
              "default": "concise"
            },
            "description": "Strict evidence mode (DEV-2923 B3): omitted means concise (`evidence` null in the response). Exact lowercase `concise`/`full` only — an empty, unknown, uppercase, or DUPLICATED value is a 400, never a silent downgrade. `full` adds the bounded metadata-only evidence block (cap 25 items per family, normalized totalCount, truthful truncated, typed continuation)."
          }
        ],
        "responses": {
          "200": {
            "description": "Candidate dossier",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "dossier"
                  ],
                  "properties": {
                    "dossier": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "proposalId",
                        "asOf",
                        "candidate",
                        "proposal",
                        "aiInterview",
                        "verification",
                        "engagement",
                        "evidenceMode",
                        "evidence",
                        "reviews",
                        "contractHistory",
                        "availability",
                        "missing",
                        "redactions",
                        "provenance"
                      ],
                      "properties": {
                        "proposalId": {
                          "type": "string"
                        },
                        "asOf": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Stable assembly timestamp shared by every provenance entry"
                        },
                        "candidate": {
                          "type": "object",
                          "additionalProperties": false,
                          "description": "Explicit allowlisted, masked candidate summary (first name + last-name initial only; no contact information)",
                          "required": [
                            "id",
                            "profileSlug",
                            "profilePath",
                            "displayName",
                            "firstName",
                            "lastNameInitial",
                            "talentType",
                            "title",
                            "bio",
                            "city",
                            "countryCode",
                            "country",
                            "profilePhotoUrl",
                            "hourlyRateUsd",
                            "hourlyRateStatus",
                            "availability",
                            "expertiseLevel",
                            "englishLevel",
                            "memberSince",
                            "identityVerified",
                            "skills",
                            "languages",
                            "stats",
                            "agency",
                            "labelExperience",
                            "workExperience",
                            "education",
                            "links"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "profileSlug": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "profilePath": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "firstName": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "lastNameInitial": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "talentType": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "enum": [
                                "Individual",
                                "Agency",
                                null
                              ]
                            },
                            "title": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "bio": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "city": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "countryCode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "profilePhotoUrl": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "hourlyRateUsd": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "hourlyRateStatus": {
                              "type": "string",
                              "enum": [
                                "VALID",
                                "MISSING",
                                "INVALID_RATE_DATA"
                              ],
                              "description": "DEV-3025 rate integrity: INVALID_RATE_DATA means the stored value fell outside the canonical 1..1000 USD / 2-decimal shape and hourlyRateUsd is null."
                            },
                            "availability": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "expertiseLevel": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "englishLevel": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "memberSince": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "identityVerified": {
                              "type": "boolean",
                              "description": "The Identity verified badge: verified and the profile name matches the name on the verified ID (OPE-44675)."
                            },
                            "skills": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "subjectMatter",
                                "tags",
                                "software",
                                "dataTypes",
                                "labelTypes"
                              ],
                              "properties": {
                                "subjectMatter": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "tags": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "software": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "dataTypes": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "labelTypes": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "languages": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "language",
                                  "proficiency"
                                ],
                                "properties": {
                                  "language": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "proficiency": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            },
                            "stats": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "totalEarnedUsd",
                                "billedHours",
                                "jobSuccessScore",
                                "reviewCount",
                                "averageRating"
                              ],
                              "properties": {
                                "totalEarnedUsd": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "billedHours": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "jobSuccessScore": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "reviewCount": {
                                  "type": "integer"
                                },
                                "averageRating": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              }
                            },
                            "agency": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "additionalProperties": false,
                              "required": [
                                "name",
                                "headcount",
                                "industryExperience"
                              ],
                              "properties": {
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "headcount": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "industryExperience": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "labelExperience": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "title",
                                  "description",
                                  "fromYear",
                                  "toYear",
                                  "ongoing",
                                  "software",
                                  "dataType",
                                  "labelTypes"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "description": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fromYear": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "toYear": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "ongoing": {
                                    "type": "boolean"
                                  },
                                  "software": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "dataType": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "labelTypes": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            },
                            "workExperience": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "title",
                                  "company",
                                  "description",
                                  "fromYear",
                                  "toYear",
                                  "current",
                                  "city",
                                  "country"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "company": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "description": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fromYear": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "toYear": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "current": {
                                    "type": "boolean"
                                  },
                                  "city": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "country": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            },
                            "education": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "school",
                                  "degree",
                                  "areaOfStudy",
                                  "fromYear",
                                  "toYear",
                                  "description"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "school": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "degree": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "areaOfStudy": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fromYear": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "toYear": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "description": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              }
                            },
                            "links": {
                              "$ref": "#/components/schemas/CandidateDossierLinks"
                            }
                          }
                        },
                        "proposal": {
                          "type": "object",
                          "additionalProperties": false,
                          "description": "THIS authorized proposal — its own bid is intentionally included; evidence and cross-buyer sections never carry compensation.",
                          "required": [
                            "id",
                            "jobId",
                            "jobTitle",
                            "status",
                            "bid",
                            "createdAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "jobId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "jobTitle": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "status": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "raw",
                                "label"
                              ],
                              "properties": {
                                "raw": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "label": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              }
                            },
                            "bid": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amountUsd",
                                "unit",
                                "amountStatus",
                                "labelerHourlyRateUsd",
                                "labelerHourlyRateStatus"
                              ],
                              "properties": {
                                "amountUsd": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "amountStatus": {
                                  "type": "string",
                                  "enum": [
                                    "VALID",
                                    "MISSING",
                                    "INVALID_RATE_DATA"
                                  ],
                                  "description": "DEV-3025: hourly bids outside 1..1000 USD / 2 decimals read null + INVALID_RATE_DATA; fixed-price and per-label amounts are never hourly-bounded."
                                },
                                "labelerHourlyRateUsd": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "labelerHourlyRateStatus": {
                                  "type": "string",
                                  "enum": [
                                    "VALID",
                                    "MISSING",
                                    "INVALID_RATE_DATA"
                                  ]
                                }
                              }
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        "aiInterview": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "score",
                            "interviewOnlyScore",
                            "summary",
                            "transcriptAvailable"
                          ],
                          "properties": {
                            "score": {
                              "type": [
                                "number",
                                "null"
                              ],
                              "description": "Stored headline number — the interview+history composite when a score breakdown exists (byte-compatible with pre-existing consumers)."
                            },
                            "interviewOnlyScore": {
                              "type": [
                                "number",
                                "null"
                              ],
                              "description": "Interview-only sub-score (the number OpenTrain UIs show); equals the stored number for records without a breakdown."
                            },
                            "summary": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "transcriptAvailable": {
                              "type": "boolean"
                            }
                          }
                        },
                        "verification": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "location",
                            "identity",
                            "identityAssurance",
                            "currentLocation",
                            "projectEligibility"
                          ],
                          "properties": {
                            "location": {
                              "$ref": "#/components/schemas/CandidateProposalTimeLocation"
                            },
                            "identity": {
                              "$ref": "#/components/schemas/CandidateIdentityVerdict"
                            },
                            "identityAssurance": {
                              "$ref": "#/components/schemas/CandidateIdentityAssurance"
                            },
                            "currentLocation": {
                              "$ref": "#/components/schemas/CandidateDossierCurrentLocationDetail"
                            },
                            "projectEligibility": {
                              "$ref": "#/components/schemas/CandidateProjectEligibility"
                            }
                          }
                        },
                        "engagement": {
                          "$ref": "#/components/schemas/CandidateDossierEngagement"
                        },
                        "evidenceMode": {
                          "type": "string",
                          "enum": [
                            "CONCISE",
                            "FULL"
                          ]
                        },
                        "evidence": {
                          "$ref": "#/components/schemas/CandidateDossierEvidence"
                        },
                        "reviews": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "totalCount",
                            "averageRating"
                          ],
                          "properties": {
                            "totalCount": {
                              "type": "integer"
                            },
                            "averageRating": {
                              "type": [
                                "number",
                                "null"
                              ]
                            }
                          }
                        },
                        "contractHistory": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "totalCount",
                            "activeCount",
                            "endedCount"
                          ],
                          "properties": {
                            "totalCount": {
                              "type": "integer"
                            },
                            "activeCount": {
                              "type": "integer"
                            },
                            "endedCount": {
                              "type": "integer"
                            }
                          }
                        },
                        "availability": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "candidate",
                            "proposal",
                            "aiInterview",
                            "verification",
                            "reviews",
                            "contractHistory"
                          ],
                          "properties": {
                            "candidate": {
                              "type": "string",
                              "enum": [
                                "available",
                                "missing"
                              ]
                            },
                            "proposal": {
                              "type": "string",
                              "enum": [
                                "available",
                                "missing"
                              ]
                            },
                            "aiInterview": {
                              "type": "string",
                              "enum": [
                                "available",
                                "missing"
                              ]
                            },
                            "verification": {
                              "type": "string",
                              "enum": [
                                "available",
                                "missing"
                              ]
                            },
                            "reviews": {
                              "type": "string",
                              "enum": [
                                "available",
                                "missing"
                              ]
                            },
                            "contractHistory": {
                              "type": "string",
                              "enum": [
                                "available",
                                "missing"
                              ]
                            }
                          }
                        },
                        "missing": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "candidate",
                              "proposal",
                              "aiInterview",
                              "verification",
                              "reviews",
                              "contractHistory"
                            ]
                          }
                        },
                        "redactions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "section",
                              "field",
                              "reason",
                              "note"
                            ],
                            "properties": {
                              "section": {
                                "type": "string",
                                "enum": [
                                  "candidate",
                                  "proposal",
                                  "aiInterview",
                                  "verification",
                                  "reviews",
                                  "contractHistory"
                                ]
                              },
                              "field": {
                                "type": "string"
                              },
                              "reason": {
                                "type": "string",
                                "enum": [
                                  "PRIVACY_MASKED",
                                  "NEVER_SHARED"
                                ]
                              },
                              "note": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "provenance": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "section",
                              "source",
                              "asOf"
                            ],
                            "properties": {
                              "section": {
                                "type": "string",
                                "enum": [
                                  "candidate",
                                  "proposal",
                                  "aiInterview",
                                  "verification",
                                  "reviews",
                                  "contractHistory"
                                ]
                              },
                              "source": {
                                "type": "string"
                              },
                              "asOf": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid evidence mode: empty, unknown, uppercase, or duplicated `evidence` query values are rejected — never silently downgraded to concise",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing scope, unclaimed account, or cross-organization proposal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal, candidate, or dossier not found (fail-closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/dossier/reviews": {
      "get": {
        "tags": [
          "candidate-dossier"
        ],
        "summary": "List candidate dossier reviews (pageable)",
        "description": "Requires `candidate_dossier:read`, the default-off candidate-dossier agent surface, and a claimed account. Pages the same curated review set the public profile exposes; `nextCursor` signals continuation so nothing truncates silently. Hidden or banned candidates read as 404. Employer-authored review comments are sanitized server-side (DEV-3129): emails, phone numbers, links, physical addresses and messaging handles become explicit [REDACTED_EMAIL]/[REDACTED_PHONE]/[REDACTED_LINK]/[REDACTED_PHYSICAL_ADDRESS]/[REDACTED_CONTACT_HANDLE] placeholders, and `redactions` carries one PRIVACY_MASKED entry per category of each redacted comment on the page (section `reviews`, field `reviews[<index>].comment`; never the removed value). A clean comment gets no entry. The stored review is unchanged.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dossier reviews page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "proposalId",
                    "asOf",
                    "reviews",
                    "nextCursor",
                    "totalCount",
                    "redactions"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "reviews": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "categories",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "categories": {
                            "type": "object",
                            "properties": {
                              "labelQuality": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "communication": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "speed": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "software": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "instructionFollowing": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              }
                            }
                          },
                          "comment": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "totalCount": {
                      "type": "integer"
                    },
                    "redactions": {
                      "type": "array",
                      "description": "DEV-3129: PRIVACY_MASKED provenance for redacted review comments on this page (always stamped, including []; never the removed value).",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "section",
                          "field",
                          "reason",
                          "note"
                        ],
                        "properties": {
                          "section": {
                            "type": "string",
                            "enum": [
                              "reviews"
                            ]
                          },
                          "field": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string",
                            "enum": [
                              "PRIVACY_MASKED"
                            ]
                          },
                          "note": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing scope, unclaimed account, or cross-organization proposal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal or candidate not found (fail-closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/dossier/contract-history": {
      "get": {
        "tags": [
          "candidate-dossier"
        ],
        "summary": "List candidate dossier contract history (pageable)",
        "description": "Requires `candidate_dossier:read`, the default-off candidate-dossier agent surface, and a claimed account. Privacy-safe engagement history (job title, status, dates, reviewed flag) — cross-buyer compensation amounts are never included. Demo and sample rows are never listed or counted: employer tour fixtures, the docs-demo seed, the DEMO_* credential accounts and the Bubble-era onboarding “Sample Job” engagements are excluded on every agent-facing read, with no opt-in (DEV-2924). `nextCursor` signals continuation so nothing truncates silently. Hidden or banned candidates read as 404.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dossier contract-history page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "proposalId",
                    "asOf",
                    "contracts",
                    "nextCursor",
                    "totalCount"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "contracts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "status",
                          "reviewed"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "jobTitle": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "ENDED"
                            ]
                          },
                          "startedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "endedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "reviewed": {
                            "type": "boolean"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "totalCount": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing scope, unclaimed account, or cross-organization proposal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal or candidate not found (fail-closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/candidates/{userId}/dossier/applications": {
      "get": {
        "tags": [
          "candidate-dossier"
        ],
        "summary": "List a candidate's platform-wide application history (platform admin, pageable)",
        "description": "DEV-2887 — `candidate_dossier.applications.list`. Requires `candidate_dossier:read`, the default-off candidate-dossier agent surface, a claimed account, and the named canonical-admin exception (platform admin AND canonical OpenTrain admin organization membership, or the named platform admin). Gate order: family flag → scope → claimed account → candidate self (typed 403 `SELF_ACCESS_NOT_SUPPORTED`) → canonical-admin seam (EVERY other caller receives the uniform non-enumerating 404 BEFORE any target read) → canonical freelancer visibility (unknown, banned, or closed targets read the same 404; private profiles are readable to the eligible admin). PROPOSAL and INVITE rows are returned and counted SEPARATELY; membership and `counts`/`velocity` are frozen at `asOf` and every continuation cursor is bound to the candidate AND the original `asOf`, so nothing drifts or truncates silently. Organizations resolve through the canonical job→organization resolver (unresolvable jobs stay null and are disclosed). A resulting contract is ONLY an exact offer-linked contract; tour-fixture jobs are excluded. Never cover letters, contact details, messages, assessments, or private review notes. Responses are never cacheable.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque continuation bound to this candidate and the ORIGINAL asOf; a malformed, foreign-version, or foreign-candidate cursor is a typed 400.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Candidate application history page (exact aggregates)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "userId",
                    "asOf",
                    "applications",
                    "nextCursor",
                    "totalCount",
                    "counts",
                    "velocity",
                    "redaction",
                    "provenance"
                  ],
                  "properties": {
                    "userId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "applications": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CandidateDossierApplicationItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "totalCount": {
                      "type": "integer"
                    },
                    "counts": {
                      "type": "object",
                      "description": "Computed over ALL rows as of `asOf`, not only the current page.",
                      "additionalProperties": false,
                      "required": [
                        "proposals",
                        "invites",
                        "distinctJobs",
                        "distinctOrganizations",
                        "contractsResulted"
                      ],
                      "properties": {
                        "proposals": {
                          "type": "integer"
                        },
                        "invites": {
                          "type": "integer"
                        },
                        "distinctJobs": {
                          "type": "integer"
                        },
                        "distinctOrganizations": {
                          "type": "integer"
                        },
                        "contractsResulted": {
                          "type": "integer"
                        }
                      }
                    },
                    "velocity": {
                      "type": "object",
                      "description": "Timing over PROPOSAL rows only (invites are employer actions).",
                      "additionalProperties": false,
                      "required": [
                        "firstProposalAt",
                        "lastProposalAt",
                        "spanDays",
                        "proposalsLast7Days",
                        "proposalsLast30Days",
                        "peak24hCount"
                      ],
                      "properties": {
                        "firstProposalAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "lastProposalAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "spanDays": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "proposalsLast7Days": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "proposalsLast30Days": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "peak24hCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Largest number of proposals created inside any 24-hour window (boundary inclusive)."
                        }
                      }
                    },
                    "redaction": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "scope",
                        "excluded"
                      ],
                      "properties": {
                        "scope": {
                          "type": "string",
                          "enum": [
                            "PLATFORM_ADMIN"
                          ]
                        },
                        "excluded": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "COVER_LETTER",
                              "CONTACT_DETAILS",
                              "MESSAGES",
                              "ASSESSMENTS",
                              "PRIVATE_REVIEW_NOTES"
                            ]
                          }
                        }
                      }
                    },
                    "provenance": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "source",
                        "aggregatesScope",
                        "organizationResolution"
                      ],
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "CANONICAL_JOBOFFER_ROWS"
                          ]
                        },
                        "aggregatesScope": {
                          "type": "string",
                          "enum": [
                            "ALL_ROWS"
                          ]
                        },
                        "organizationResolution": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "unresolvedJobs"
                          ],
                          "properties": {
                            "unresolvedJobs": {
                              "type": "integer",
                              "minimum": 0
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Blank userId, invalid limit, or invalid/foreign cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Candidate self-access (reason SELF_ACCESS_NOT_SUPPORTED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Uniform non-enumerating not-found for every non-canonical-admin caller and for unknown, banned, or closed candidates",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/dossier/resume": {
      "get": {
        "tags": [
          "candidate-dossier"
        ],
        "summary": "Audited candidate resume access (fresh signed link or redirect)",
        "description": "DEV-2977 B3.5 — the audited same-origin resume access the dossier `links.resume.url` pointer targets. Requires BOTH `candidate_dossier:read` AND `candidate_documents:read` (every listed scope is required; a metadata-only token is refused with a typed 403 naming the missing grant), the default-off candidate-dossier agent surface, a claimed account, and named canonical-admin authority for the exact proposal — resume FILES are admin-only (owner decision 2026-09-23): employers, delegates and agents acting for them pass the proposal-ownership boundary and are then refused with a typed `RESUME_FILES_ADMIN_ONLY` 403; platform-admin status alone is never an ownership bridge; candidate self receives a typed `SELF_ACCESS_NOT_SUPPORTED` 403 — self-service resume access is a separate product path. `mode` is a strict exact-lowercase enum: absent/`link` returns the closed JSON projection; `redirect` responds 302 with `Location` = a freshly minted 600-second signed storage URL when AVAILABLE and 409 with the SAME projection body (no Location) otherwise. Missing/redacted/storage-unavailable resumes are truthful data states, never operation failures: a legacy external resume reference — well-formed or malformed — is REDACTED and never passed through, proxied, or fetched. Every admitted request is audited append-only BEFORE any URL is disclosed; an audit-write failure is a typed 500 with nothing disclosed; storage-provider failure is a typed retryable 503. Rate-limited per token (30/minute, canonical 429 envelope with Retry-After and X-RateLimit-* headers). Unknown/foreign/hidden/banned candidates keep the dossier 404/403 semantics. Responses are never cacheable (Cache-Control: no-store).",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "description": "Strict: exactly 'link' (default) or 'redirect'. Empty, uppercase, or unknown values are 400 BEFORE auth; a duplicated parameter is rejected rather than first-wins.",
            "schema": {
              "type": "string",
              "enum": [
                "link",
                "redirect"
              ],
              "default": "link"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed link-mode projection (also returned by mode=link for every availability)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Exact five-variant projection: AVAILABLE (signed url + RFC3339 expiry + null reason) with provenanceStatus AVAILABLE + the observed provenance object, or with provenanceStatus UNAVAILABLE + null; or one of the three unavailable states (null url/expiry + their exact reasons) with provenanceStatus NOT_APPLICABLE + null. Provenance is observed at issuance (DEV-3024) and never binds the later download.",
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri",
                          "description": "Freshly minted 600-second signed storage URL (absolute http(s), no embedded credentials). Never a legacy external reference."
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "RFC3339 expiry of the signed URL, anchored to the pre-signing instant (never overstates validity)."
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "AVAILABLE"
                          ]
                        },
                        "reason": {
                          "type": "null"
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "AVAILABLE"
                          ]
                        },
                        "provenance": {
                          "$ref": "#/components/schemas/CandidateDossierResumeProvenance"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri",
                          "description": "Freshly minted 600-second signed storage URL (absolute http(s), no embedded credentials). Never a legacy external reference."
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "RFC3339 expiry of the signed URL, anchored to the pre-signing instant (never overstates validity)."
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "AVAILABLE"
                          ]
                        },
                        "reason": {
                          "type": "null"
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "UNAVAILABLE"
                          ],
                          "description": "The signed link was granted but the storage object description was unavailable (non-fatal, time-bounded lookup)."
                        },
                        "provenance": {
                          "type": "null"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "null"
                        },
                        "expiresAt": {
                          "type": "null"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "MISSING"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "NOT_PROVIDED"
                          ]
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE"
                          ]
                        },
                        "provenance": {
                          "type": "null"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "null"
                        },
                        "expiresAt": {
                          "type": "null"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "LEGACY_EXTERNAL_REFERENCE_REDACTED"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "EXTERNAL_REFERENCE_REDACTED"
                          ]
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE"
                          ]
                        },
                        "provenance": {
                          "type": "null"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "null"
                        },
                        "expiresAt": {
                          "type": "null"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "STORAGE_OBJECT_UNAVAILABLE"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "STORAGE_OBJECT_UNAVAILABLE"
                          ]
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE"
                          ]
                        },
                        "provenance": {
                          "type": "null"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "302": {
            "description": "mode=redirect with an AVAILABLE resume: empty body, `Location` = freshly minted 600-second signed storage URL, `Cache-Control: no-store`, `x-request-id`.",
            "headers": {
              "Location": {
                "description": "Freshly minted short-lived signed storage URL (600-second TTL).",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid, empty, uppercase, or duplicated mode parameter (rejected before auth), or missing proposalId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing scope (typed details name the exact missing grant), unclaimed account, cross-organization proposal, employer/delegate without canonical-admin authority (reason RESUME_FILES_ADMIN_ONLY — resume files are admin-only), or candidate self-access (reason SELF_ACCESS_NOT_SUPPORTED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal or candidate not found (fail-closed, non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "mode=redirect when no redirect can be issued (MISSING, LEGACY_EXTERNAL_REFERENCE_REDACTED, or STORAGE_OBJECT_UNAVAILABLE): the SAME closed projection body as link mode, with NO Location header",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The redirect-conflict body: the SAME projection restricted to the three unavailable states (a 409 with availability AVAILABLE is impossible).",
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "null"
                        },
                        "expiresAt": {
                          "type": "null"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "MISSING"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "NOT_PROVIDED"
                          ]
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE"
                          ]
                        },
                        "provenance": {
                          "type": "null"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "null"
                        },
                        "expiresAt": {
                          "type": "null"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "LEGACY_EXTERNAL_REFERENCE_REDACTED"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "EXTERNAL_REFERENCE_REDACTED"
                          ]
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE"
                          ]
                        },
                        "provenance": {
                          "type": "null"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "url",
                        "expiresAt",
                        "availability",
                        "reason",
                        "provenanceStatus",
                        "provenance"
                      ],
                      "properties": {
                        "url": {
                          "type": "null"
                        },
                        "expiresAt": {
                          "type": "null"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "STORAGE_OBJECT_UNAVAILABLE"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "STORAGE_OBJECT_UNAVAILABLE"
                          ]
                        },
                        "provenanceStatus": {
                          "type": "string",
                          "enum": [
                            "NOT_APPLICABLE"
                          ]
                        },
                        "provenance": {
                          "type": "null"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Per-token rate limit exceeded (30/minute; canonical envelope with Retry-After and X-RateLimit-Limit/Remaining/Reset headers). The limiter is consumed only AFTER flag/scope/claimed-account eligibility, so ineligible tokens keep their deterministic 403s.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Primary audit write failed: nothing was disclosed (an unaudited grant is impossible); retryable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Storage provider failure (distinct from a truthful STORAGE_OBJECT_UNAVAILABLE data state); retryable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/participant/work-email": {
      "get": {
        "tags": [
          "participant-work-email"
        ],
        "summary": "Audited participant work email by contract",
        "description": "DEV-3031 B3.6 — `participant_work_email.get` for the exact contract's participant. Requires `participant_work_email:read` (a dedicated sensitive-contact grant — separate from payments/candidate-dossier scopes and from the partner participants:email consent scope), the default-off participant-work-email agent surface, a claimed account, and employer or named canonical-admin authority for the exact contract context (candidate self receives a typed `SELF_ACCESS_NOT_SUPPORTED` 403). Returns the closed eight-state projection: ONLY `ACTIVE` carries an address — always the normalized lowercase managed primary exactly under `opentrain.work` with a confirmed provider mailbox; the personal signup/login email is NEVER returned in any state. An admitted ENDED contract is the typed `CONTRACT_ENDED` 200 state (never a cross-job bridge to another active contract). Every authenticated attempt — admitted data states AND denials — is audited append-only BEFORE any address is disclosed; an audit-write failure on an admitted read is a typed 500 with nothing disclosed. Unknown and foreign contracts are ONE uniform non-enumerating 404. Rate-limited per token (30/minute, canonical 429 envelope). Responses are never cacheable (Cache-Control: no-store).",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed participant work-email projection (typed non-disclosure states are truthful 200 data states)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "participantUserId",
                    "jobId",
                    "contractId",
                    "proposalId",
                    "workEmail"
                  ],
                  "properties": {
                    "participantUserId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contractId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "proposalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workEmail": {
                      "description": "Exact eight-state projection: ACTIVE (the only variant with an address) or a typed non-disclosure state. CONTRACT_ENDED/NOT_HIRED are admitted CONTEXT states decided before any work-email read (null provenance).",
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "ACTIVE"
                              ]
                            },
                            "address": {
                              "type": "string",
                              "format": "email",
                              "pattern": "^[a-z0-9][a-z0-9._+-]*@opentrain\\.work$",
                              "description": "The normalized lowercase managed primary address, exactly under opentrain.work with a confirmed provider mailbox. Never a personal/signup/login email."
                            },
                            "reason": {
                              "type": "null"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "PENDING"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "PROVISIONING_PENDING"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "NEEDS_REPAIR"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_REPAIR_REQUIRED",
                                "INVALID_PRIMARY_ADDRESS",
                                "DOMAIN_MISMATCH",
                                "PROVIDER_MAILBOX_UNCONFIRMED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "DISABLED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_DISABLED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "SUPERSEDED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "PRIMARY_SUPERSEDED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "MISSING"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_MISSING",
                                "PRIMARY_MISSING"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "CONTRACT_ENDED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "CONTRACT_ENDED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": "null"
                            },
                            "updatedAt": {
                              "type": "null"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "NOT_HIRED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "NOT_HIRED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": "null"
                            },
                            "updatedAt": {
                              "type": "null"
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or empty contractId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing participant_work_email:read scope, unclaimed account, or self-access (reason SELF_ACCESS_NOT_SUPPORTED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or foreign contract (ONE uniform non-enumerating response)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Per-token rate limit exceeded (30/minute; canonical envelope with Retry-After and X-RateLimit-* headers). The limiter is consumed only AFTER flag/scope/claimed-account eligibility.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Primary audit write failed: nothing was disclosed (an unaudited read is impossible); retryable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/participant/work-email": {
      "get": {
        "tags": [
          "participant-work-email"
        ],
        "summary": "Audited participant work email by proposal",
        "description": "DEV-3031 B3.6 — `participant_work_email.get` through a proposal's exact job/person relation. Same authorization, audit, privacy, and non-enumeration contract as the contract-selector route. A proposal whose candidate has NO hired contract returns the typed `NOT_HIRED` 200 state — pre-hire contact data is never disclosed; hire linkage binds to THIS proposal only (never 'any contract for this person'). An ended hired contract is the typed `CONTRACT_ENDED` 200 state.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed participant work-email projection (NOT_HIRED/CONTRACT_ENDED are truthful 200 context states)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "participantUserId",
                    "jobId",
                    "contractId",
                    "proposalId",
                    "workEmail"
                  ],
                  "properties": {
                    "participantUserId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contractId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "proposalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workEmail": {
                      "description": "Exact eight-state projection: ACTIVE (the only variant with an address) or a typed non-disclosure state. CONTRACT_ENDED/NOT_HIRED are admitted CONTEXT states decided before any work-email read (null provenance).",
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "ACTIVE"
                              ]
                            },
                            "address": {
                              "type": "string",
                              "format": "email",
                              "pattern": "^[a-z0-9][a-z0-9._+-]*@opentrain\\.work$",
                              "description": "The normalized lowercase managed primary address, exactly under opentrain.work with a confirmed provider mailbox. Never a personal/signup/login email."
                            },
                            "reason": {
                              "type": "null"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "PENDING"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "PROVISIONING_PENDING"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "NEEDS_REPAIR"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_REPAIR_REQUIRED",
                                "INVALID_PRIMARY_ADDRESS",
                                "DOMAIN_MISMATCH",
                                "PROVIDER_MAILBOX_UNCONFIRMED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "DISABLED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_DISABLED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "SUPERSEDED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "PRIMARY_SUPERSEDED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "MISSING"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_MISSING",
                                "PRIMARY_MISSING"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "CONTRACT_ENDED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "CONTRACT_ENDED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": "null"
                            },
                            "updatedAt": {
                              "type": "null"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "NOT_HIRED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "NOT_HIRED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": "null"
                            },
                            "updatedAt": {
                              "type": "null"
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or empty proposalId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing participant_work_email:read scope, unclaimed account, or candidate self-access (reason SELF_ACCESS_NOT_SUPPORTED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or foreign proposal (ONE uniform non-enumerating response)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Per-token rate limit exceeded (30/minute; canonical envelope with Retry-After and X-RateLimit-* headers).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Primary audit write failed: nothing was disclosed (an unaudited read is impossible); retryable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{jobId}/people/{personUserId}/work-email": {
      "get": {
        "tags": [
          "participant-work-email"
        ],
        "summary": "Audited participant work email by job + person",
        "description": "DEV-3031 B3.6 — `participant_work_email.get` bound to the exact job context. A bare user id is never authority: this form requires employer or named canonical-admin authority for the EXACT job plus an ACTIVE contract for that person on THAT job (an active contract on any other job never bridges access). A person with no ACTIVE contract on the job — no contract at all, only-ended history, or proposal-stage candidacy — is the same uniform non-enumerating 404; ended and pre-hire contexts are readable only through the exact contract/proposal selectors and their typed CONTRACT_ENDED/NOT_HIRED states. Same authorization, audit, and privacy contract as the contract-selector route.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "personUserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed participant work-email projection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "participantUserId",
                    "jobId",
                    "contractId",
                    "proposalId",
                    "workEmail"
                  ],
                  "properties": {
                    "participantUserId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contractId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "proposalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workEmail": {
                      "description": "Exact eight-state projection: ACTIVE (the only variant with an address) or a typed non-disclosure state. CONTRACT_ENDED/NOT_HIRED are admitted CONTEXT states decided before any work-email read (null provenance).",
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "ACTIVE"
                              ]
                            },
                            "address": {
                              "type": "string",
                              "format": "email",
                              "pattern": "^[a-z0-9][a-z0-9._+-]*@opentrain\\.work$",
                              "description": "The normalized lowercase managed primary address, exactly under opentrain.work with a confirmed provider mailbox. Never a personal/signup/login email."
                            },
                            "reason": {
                              "type": "null"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "PENDING"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "PROVISIONING_PENDING"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "NEEDS_REPAIR"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_REPAIR_REQUIRED",
                                "INVALID_PRIMARY_ADDRESS",
                                "DOMAIN_MISMATCH",
                                "PROVIDER_MAILBOX_UNCONFIRMED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "DISABLED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_DISABLED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "SUPERSEDED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "PRIMARY_SUPERSEDED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "MISSING"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ACCOUNT_MISSING",
                                "PRIMARY_MISSING"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "CONTRACT_ENDED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "CONTRACT_ENDED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": "null"
                            },
                            "updatedAt": {
                              "type": "null"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "address",
                            "reason",
                            "source",
                            "provisionedAt",
                            "updatedAt"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "NOT_HIRED"
                              ]
                            },
                            "address": {
                              "type": "null"
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "NOT_HIRED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "OPENTRAIN_MANAGED_WORK_EMAIL"
                              ]
                            },
                            "provisionedAt": {
                              "type": "null"
                            },
                            "updatedAt": {
                              "type": "null"
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or empty jobId/personUserId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing participant_work_email:read scope, unclaimed account, or self-access (reason SELF_ACCESS_NOT_SUPPORTED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or foreign job, or no ACTIVE contract for the person on this exact job — including ended-only histories (ONE uniform non-enumerating response)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Per-token rate limit exceeded (30/minute; canonical envelope with Retry-After and X-RateLimit-* headers).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Primary audit write failed: nothing was disclosed (an unaudited read is impossible); retryable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/admin/work-email/delivery-checks": {
      "post": {
        "tags": [
          "admin-work-email"
        ],
        "summary": "Check managed work-email delivery (admin-only, audited, read-only)",
        "description": "DEV-2975 — `admin_work_email.delivery_check`. Did a sender’s mail reach an exact managed `@opentrain.work` address in a bounded window? Use it before asking a client to resend an external-platform invitation. Requires `work_email_delivery:read` (explicit-mint only: never part of Full access), an employer key (freelancer and device keys are refused), a claimed account, and the canonical-admin exception (direct platform admin AND active membership in the OpenTrain admin organization, or the named platform admin); a key bound to another organization is refused. The gate runs before any address is read, so non-admins learn nothing about which mailboxes exist. Delivery metadata only: the matched sender’s domain, a sanitized subject (at most 300 characters), received time, folder (Inbox / Junk / other) and provider ids — never bodies, previews, attachments, display names, other recipients or the person’s signup email; the sender address is returned only when it equals `fromAddress`. A sender filter, a window of at most 14 days (start at most 30 days ago) and a single-line reason are mandatory. A match must be received mail (drafts and sent copies never count) naming the exact address in To or Cc. The provider’s candidates are scanned up to 500 (`coverage`). Verdicts: `DELIVERED`, `DELIVERED_TO_JUNK`, `NOT_FOUND` (every candidate scanned, none matched), `INCONCLUSIVE` (no match before the scan cap — never reported as `NOT_FOUND`), `MAILBOX_UNAVAILABLE` (with the mailbox or managed-alias state and reason; the provider is not read) and `MAILBOX_NOT_FOUND`; a provider failure is a distinct retryable 503 `PROVIDER_UNAVAILABLE`. SMTP-level refusals live only in the mail server log, which this check does not read (`rejectionEvidence.smtpLog = NOT_CHECKED`): `NOT_FOUND` means not in the mailbox, not that the sender was refused. Every check, admitted or refused, is written to an append-only audit ledger (actor, token, target mailbox, filters, window, reason, outcome, counts — never a subject); admitted checks are written before the result returns, and when that write fails nothing is disclosed. POST keeps the reason out of URLs. Rate-limited per token (30/minute). Never cacheable.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "address",
                  "since",
                  "reason"
                ],
                "properties": {
                  "address": {
                    "type": "string",
                    "maxLength": 254,
                    "description": "Exact managed address (primary, address or alias) under opentrain.work."
                  },
                  "fromDomain": {
                    "type": "string",
                    "maxLength": 253,
                    "description": "Bare sender domain; matches the domain or any subdomain."
                  },
                  "fromAddress": {
                    "type": "string",
                    "maxLength": 254,
                    "description": "Exact sender address."
                  },
                  "subjectContains": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "since": {
                    "type": "string",
                    "format": "date-time",
                    "description": "At most 30 days ago."
                  },
                  "until": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Default now; the window spans at most 14 days."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 500,
                    "description": "Single-line reason, stored in the admin audit only."
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 25,
                    "default": 10
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "fromDomain"
                    ]
                  },
                  {
                    "required": [
                      "fromAddress"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audited delivery verdict with delivery metadata only",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "address",
                    "mailbox",
                    "verdict",
                    "matchedCount",
                    "truncated",
                    "coverage",
                    "messages",
                    "rejectionEvidence",
                    "window",
                    "auditEventId"
                  ],
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "mailbox": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "state",
                        "reason",
                        "routed"
                      ],
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "PENDING",
                            "NEEDS_REPAIR",
                            "DISABLED",
                            "SUPERSEDED",
                            "ALIAS_INACTIVE",
                            "NOT_FOUND"
                          ]
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "routed": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        }
                      }
                    },
                    "verdict": {
                      "type": "string",
                      "enum": [
                        "DELIVERED",
                        "DELIVERED_TO_JUNK",
                        "NOT_FOUND",
                        "INCONCLUSIVE",
                        "MAILBOX_UNAVAILABLE",
                        "MAILBOX_NOT_FOUND"
                      ]
                    },
                    "matchedCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "coverage": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "scanned",
                        "providerTotal",
                        "complete"
                      ],
                      "properties": {
                        "scanned": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "providerTotal": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "complete": {
                          "type": "boolean"
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "maxItems": 25,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "providerMessageId",
                          "internetMessageId",
                          "receivedAt",
                          "folder",
                          "senderDomain",
                          "senderAddress",
                          "subject"
                        ],
                        "properties": {
                          "providerMessageId": {
                            "type": "string"
                          },
                          "internetMessageId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "receivedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "folder": {
                            "type": "string",
                            "enum": [
                              "INBOX",
                              "JUNK",
                              "OTHER"
                            ]
                          },
                          "senderDomain": {
                            "type": "string"
                          },
                          "senderAddress": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "subject": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "rejectionEvidence": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "smtpLog",
                        "note"
                      ],
                      "properties": {
                        "smtpLog": {
                          "type": "string",
                          "enum": [
                            "NOT_CHECKED"
                          ]
                        },
                        "note": {
                          "type": "string"
                        }
                      }
                    },
                    "window": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "since",
                        "until"
                      ],
                      "properties": {
                        "since": {
                          "type": "string"
                        },
                        "until": {
                          "type": "string"
                        }
                      }
                    },
                    "auditEventId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (details.field): non-managed address, no sender filter, missing/short/multi-line reason, window over 14 days or starting more than 30 days ago, unknown field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing work_email_delivery:read (shared missing-scope remedy), a freelancer or device key (reason NON_EMPLOYER_KEY), unclaimed account, not a canonical admin (reason ADMIN_REQUIRED), or key bound to another organization (reason PRINCIPAL_ORG_MISMATCH); every refusal is recorded in the audit ledger without target data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Per-token rate limit exceeded (30/minute; canonical envelope with Retry-After and X-RateLimit-* headers).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "PROVIDER_UNAVAILABLE (mail provider unreadable; audited, retryable — nothing is known about delivery) or AUDIT_UNAVAILABLE (the check could not be audited, so nothing was disclosed; retryable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/admin-balance-hire": {
      "post": {
        "tags": [
          "admin-balance-hire"
        ],
        "summary": "Hire with ADMIN_BALANCE funding (canonical admin org only; no money moves)",
        "description": "DEV-2494 dedicated endpoint (normal hire routes never accept a balance-funding flag). Requires ALL of: the default-off admin-balance-hire agent surface, `admin_balance_hire:create`, a claimed account, direct platform-admin status, the Admin Pay allowlist, active membership in the single canonical admin organization (OPENTRAIN_ADMIN_ORG_ID; fail-closed when unset) or the named platform admin (OPE-44592: one bound user id, flagged, not closed or banned), a matching token organization, and the proposal resolving to that same organization — owner-derived admin status and job-scoped delegated payment authorizations are insufficient. Creates the contract plus the ACTIVE_FUNDED initial milestone with internal-balance funding metadata; zero money moves and no approval record is created. The later milestone approval/release that moves money stays human-only. Mutations are request-bound idempotent: the same `idempotencyKey` with the same payload converges (200 replay), key reuse with a changed payload conflicts (409), and concurrent requests can never create a duplicate contract.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "milestone"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "milestone": {
                    "type": "object",
                    "required": [
                      "description"
                    ],
                    "description": "DEV-4500: give amountUsd, volume (hours; hourly proposals only), or both. With volume the amount is volume × the contract rate (the applicant’s bid); with both, a mismatch is a 400.",
                    "properties": {
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "description": {
                        "type": "string"
                      },
                      "amountUsd": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "volume": {
                        "type": [
                          "number",
                          "null"
                        ],
                        "exclusiveMinimum": 0,
                        "description": "Funded hours (hourly proposals). Recorded on the milestone so budget.fundedVolume reflects them."
                      },
                      "dueDate": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      }
                    }
                  },
                  "rateUsd": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "description": "DEV-4500: requested contract rate (USD/hour). The contract rate defaults to the applicant’s bid unless you pass rateUsd; the contract is always created at the bid and a different rate is proposed to the worker through the compensation-change flow (PENDING until the worker accepts) — a rate different from the bid needs the worker’s acceptance and is never written silently."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay of a previously completed admin-balance hire (same closed shape; `onboarding` is recomputed live on every replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "jobId",
                    "contractId",
                    "milestone",
                    "rate",
                    "warnings",
                    "fundingSource",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "releaseRequiresHumanApproval",
                    "onboarding",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "milestone": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "status",
                        "amountUsd",
                        "volume",
                        "fundingInvoiceId"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "ACTIVE_FUNDED after creation"
                        },
                        "amountUsd": {
                          "type": "number"
                        },
                        "volume": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "DEV-4500: funded hours when the hire recorded them."
                        },
                        "fundingInvoiceId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "rate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "paymentType",
                        "contractRateUsd",
                        "bidRateUsd",
                        "postedRateUsd",
                        "requestedRateUsd",
                        "status",
                        "compensationChangeId",
                        "compensationChangeStatus",
                        "failureCode",
                        "message"
                      ],
                      "properties": {
                        "paymentType": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "contractRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The rate the contract is created at: always the applicant’s bid."
                        },
                        "bidRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "postedRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The job’s posted hourly rate (null for non-hourly jobs)."
                        },
                        "requestedRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "BID",
                            "PENDING_WORKER_ACCEPTANCE",
                            "PROPOSAL_RESOLVED",
                            "PROPOSAL_FAILED",
                            "PROPOSAL_UNKNOWN"
                          ],
                          "description": "PENDING_WORKER_ACCEPTANCE: the requested rate is proposed and still pending. PROPOSAL_RESOLVED: it was proposed and the worker (or a later proposal) already resolved it — see compensationChangeStatus. PROPOSAL_FAILED: the hire completed at the bid and the rate proposal is confirmed NOT recorded (or, with failureCode RATE_PROPOSAL_KEY_REUSED, this key is bound to a change at a different rate). PROPOSAL_UNKNOWN: the hire completed, the proposal threw and its outcome could not be confirmed. `contracts propose-rate` converges on an existing pending proposal for the same rate, so retrying is safe."
                        },
                        "compensationChangeId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "compensationChangeStatus": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "PENDING",
                            "ACCEPTED",
                            "DECLINED",
                            "APPEALED",
                            "APPEAL_ACCEPTED",
                            "SUPERSEDED",
                            "CANCELED",
                            null
                          ],
                          "description": "The compensation change’s lifecycle as read back after the hire; null when nothing was proposed or the readback failed."
                        },
                        "failureCode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "RATE_PROPOSAL_FAILED",
                            "RATE_PROPOSAL_UNKNOWN",
                            "RATE_PROPOSAL_KEY_REUSED",
                            null
                          ],
                          "description": "Bounded code set exactly when status is PROPOSAL_FAILED or PROPOSAL_UNKNOWN; never raw error text."
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "DEV-4500: e.g. the contract rate (the bid) differs from the job’s posted rate, or the requested rate is pending the worker’s acceptance."
                    },
                    "fundingSource": {
                      "type": "string",
                      "enum": [
                        "ADMIN_BALANCE"
                      ]
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "releaseRequiresHumanApproval": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "onboarding": {
                      "$ref": "#/components/schemas/NewHireOnboardingReceipt"
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Admin-balance hire created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "jobId",
                    "contractId",
                    "milestone",
                    "rate",
                    "warnings",
                    "fundingSource",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "releaseRequiresHumanApproval",
                    "onboarding",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "milestone": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "status",
                        "amountUsd",
                        "volume",
                        "fundingInvoiceId"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "ACTIVE_FUNDED after creation"
                        },
                        "amountUsd": {
                          "type": "number"
                        },
                        "volume": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "DEV-4500: funded hours when the hire recorded them."
                        },
                        "fundingInvoiceId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "rate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "paymentType",
                        "contractRateUsd",
                        "bidRateUsd",
                        "postedRateUsd",
                        "requestedRateUsd",
                        "status",
                        "compensationChangeId",
                        "compensationChangeStatus",
                        "failureCode",
                        "message"
                      ],
                      "properties": {
                        "paymentType": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "contractRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The rate the contract is created at: always the applicant’s bid."
                        },
                        "bidRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "postedRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The job’s posted hourly rate (null for non-hourly jobs)."
                        },
                        "requestedRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "BID",
                            "PENDING_WORKER_ACCEPTANCE",
                            "PROPOSAL_RESOLVED",
                            "PROPOSAL_FAILED",
                            "PROPOSAL_UNKNOWN"
                          ],
                          "description": "PENDING_WORKER_ACCEPTANCE: the requested rate is proposed and still pending. PROPOSAL_RESOLVED: it was proposed and the worker (or a later proposal) already resolved it — see compensationChangeStatus. PROPOSAL_FAILED: the hire completed at the bid and the rate proposal is confirmed NOT recorded (or, with failureCode RATE_PROPOSAL_KEY_REUSED, this key is bound to a change at a different rate). PROPOSAL_UNKNOWN: the hire completed, the proposal threw and its outcome could not be confirmed. `contracts propose-rate` converges on an existing pending proposal for the same rate, so retrying is safe."
                        },
                        "compensationChangeId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "compensationChangeStatus": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "PENDING",
                            "ACCEPTED",
                            "DECLINED",
                            "APPEALED",
                            "APPEAL_ACCEPTED",
                            "SUPERSEDED",
                            "CANCELED",
                            null
                          ],
                          "description": "The compensation change’s lifecycle as read back after the hire; null when nothing was proposed or the readback failed."
                        },
                        "failureCode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "RATE_PROPOSAL_FAILED",
                            "RATE_PROPOSAL_UNKNOWN",
                            "RATE_PROPOSAL_KEY_REUSED",
                            null
                          ],
                          "description": "Bounded code set exactly when status is PROPOSAL_FAILED or PROPOSAL_UNKNOWN; never raw error text."
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "DEV-4500: e.g. the contract rate (the bid) differs from the job’s posted rate, or the requested rate is pending the worker’s acceptance."
                    },
                    "fundingSource": {
                      "type": "string",
                      "enum": [
                        "ADMIN_BALANCE"
                      ]
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "releaseRequiresHumanApproval": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "onboarding": {
                      "$ref": "#/components/schemas/NewHireOnboardingReceipt"
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid idempotency key or milestone payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Fail-closed authorization: surface disabled, missing scope, unclaimed account, admin org not configured, not a direct platform admin, not on the Admin Pay allowlist, no active canonical-org membership (and not the named platform admin), token org mismatch, or target outside the canonical admin organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal not found (fail-closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency-key reuse with a changed payload, concurrent in-progress request, another request already hired this proposal, or a domain conflict from the hire flow",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/admin-balance-milestones": {
      "post": {
        "tags": [
          "admin-balance-hire"
        ],
        "summary": "Add an ADMIN_BALANCE-funded milestone (canonical admin org only; no money moves)",
        "description": "DEV-2494 dedicated endpoint (normal milestone routes never accept a balance-funding flag). Requires ALL of: the default-off admin-balance-hire agent surface, `admin_balance_hire:create`, a claimed account, direct platform-admin status, the Admin Pay allowlist, active membership in the single canonical admin organization (OPENTRAIN_ADMIN_ORG_ID; fail-closed when unset) or the named platform admin (OPE-44592: one bound user id, flagged, not closed or banned), a matching token organization, and the contract resolving to that same organization — owner-derived admin status and job-scoped delegated payment authorizations are insufficient. Creates the milestone and marks it ACTIVE_FUNDED with internal-balance funding metadata; zero money moves and no approval record is created. Domain sequencing applies: an earlier unreleased milestone conflicts (409) until it is approved/released, which stays human-only. Request-bound idempotency: same key + payload converges, key reuse with a changed payload conflicts, and a recovered retry converges on the same milestone row.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "milestone"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "milestone": {
                    "type": "object",
                    "required": [
                      "description",
                      "amountUsd"
                    ],
                    "properties": {
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "description": {
                        "type": "string"
                      },
                      "amountUsd": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "volume": {
                        "type": [
                          "number",
                          "null"
                        ],
                        "exclusiveMinimum": 0,
                        "description": "Hours or labels for volume-based contracts. Omit to derive from amountUsd and the canonical rate."
                      },
                      "dueDate": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay of a previously completed admin-balance milestone creation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "201": {
            "description": "Admin-balance milestone created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contractId",
                    "jobId",
                    "milestone",
                    "fundingSource",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "releaseRequiresHumanApproval",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "milestone": {
                      "type": "object",
                      "required": [
                        "id",
                        "status",
                        "amountUsd",
                        "fundingInvoiceId"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "ACTIVE_FUNDED after creation"
                        },
                        "amountUsd": {
                          "type": "number"
                        },
                        "fundingInvoiceId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "fundingSource": {
                      "type": "string",
                      "enum": [
                        "ADMIN_BALANCE"
                      ]
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "releaseRequiresHumanApproval": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid idempotency key or milestone payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Fail-closed authorization: surface disabled, missing scope, unclaimed account, admin org not configured, not a direct platform admin, not on the Admin Pay allowlist, no active canonical-org membership (and not the named platform admin), token org mismatch, or target outside the canonical admin organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found (fail-closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency-key reuse with a changed payload, concurrent in-progress request, or a milestone-sequencing conflict (previous milestone unreleased / another milestone still active)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/admin-balance-milestones/{milestoneId}/fund": {
      "post": {
        "tags": [
          "admin-balance-hire"
        ],
        "summary": "Apply ADMIN_BALANCE to an existing milestone (canonical admin org only; no money moves)",
        "description": "DEV-3342 dedicated existing-milestone operation. It is deliberately separate from the ordinary employer funding route and accepts no client-controlled funding source. Requires ALL of: the default-off admin-balance-hire agent surface, `admin_balance_hire:create`, a claimed account, direct platform-admin status, the Admin Pay allowlist, active membership in the single canonical admin organization (`OPENTRAIN_ADMIN_ORG_ID`; fail-closed when unset) or the named platform admin (OPE-44592: one bound user id, flagged, not closed or banned), a matching token organization, and the contract/job resolving to that same organization. It verifies the milestone belongs to the named contract, remains NOT_FUNDED, has internally consistent amount/rate/volume terms, and passes canonical sequencing and payment-hold checks. It then writes the same internal ADMIN_BALANCE funding metadata as creation and transitions the existing row to ACTIVE_FUNDED. Zero money moves, no Stripe charge or PaymentIntent is created, no duplicate milestone is created, and payout/release remains human-only. Request-bound idempotency makes same-key retries converge and conflicting keys or payloads fail closed.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "milestoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Admin balance applied to the existing milestone",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contractId",
                    "jobId",
                    "milestone",
                    "fundingSource",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "releaseRequiresHumanApproval",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "milestone": {
                      "type": "object",
                      "required": [
                        "id",
                        "status",
                        "amountUsd",
                        "fundingInvoiceId"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "ACTIVE_FUNDED after success"
                        },
                        "amountUsd": {
                          "type": "number"
                        },
                        "fundingInvoiceId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "fundingSource": {
                      "type": "string",
                      "enum": [
                        "ADMIN_BALANCE"
                      ]
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "releaseRequiresHumanApproval": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid idempotency key or internally inconsistent milestone amount/rate/volume",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Fail-closed authorization: surface disabled, missing scope, unclaimed account, admin org not configured, not a direct platform admin, not on the Admin Pay allowlist, no active canonical-org membership (and not the named platform admin), token org mismatch, target outside the canonical admin organization, or payment hold",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract or milestone not found (fail-closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, non-pending/terminal milestone, funding-source conflict, earlier incomplete milestone, or another active funded milestone",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/admin-balance-milestones/{milestoneId}/cancel": {
      "post": {
        "tags": [
          "admin-balance-hire"
        ],
        "summary": "Cancel a funded milestone (canonical admin org only)",
        "description": "DEV-4049 restricted administrative cancellation. Requires ALL of: the default-off admin-balance-hire agent surface, `admin_balance_hire:create`, a claimed account, direct platform-admin status, the Admin Pay allowlist, active membership in the single canonical admin organization (`OPENTRAIN_ADMIN_ORG_ID`; fail-closed when unset) or the named platform admin (OPE-44592: one bound user id, flagged, not closed or banned), a matching token organization, and the contract/job resolving to that same organization. Preserves the canonical ownership, payout, refund, contract-state and idempotency guards. The agent surface is limited to ADMIN_BALANCE funding: it cancels the internal bookkeeping row, zero money moves, and no approval record is created. Card/credit funding is refused with HUMAN_APPROVAL_REQUIRED and remains on the human-only refund path. Notifications are suppressed by default and require explicit notifyCounterparty: true.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "milestoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "notifyCounterparty": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Funded milestone cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "contractId",
                    "milestoneId",
                    "refundLedgerId",
                    "refundId",
                    "refundReasonCode",
                    "fundingDisposition",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "releaseRequiresHumanApproval",
                    "reviewProvenance",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "milestoneId": {
                      "type": "string"
                    },
                    "refundLedgerId": {
                      "type": "null"
                    },
                    "refundId": {
                      "type": "null"
                    },
                    "refundReasonCode": {
                      "type": "string",
                      "enum": [
                        "admin_balance_funded_milestone_cancellation"
                      ]
                    },
                    "fundingDisposition": {
                      "type": "string",
                      "enum": [
                        "NO_MONEY_MOVED"
                      ]
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "releaseRequiresHumanApproval": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "reviewProvenance": {
                      "type": "string",
                      "enum": [
                        "ADMIN_NO_START"
                      ]
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid idempotency key or request body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Fail-closed canonical-admin authorization refusal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract or milestone not found (fail-closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Funding, payout, refund, contract-state, or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/admin-balance-rehire": {
      "post": {
        "tags": [
          "admin-balance-hire"
        ],
        "summary": "Rehire from an ended contract with ADMIN_BALANCE funding (new contract; no money moves)",
        "description": "DEV-2834 canonical ended-contract rehire. The path contract is preserved as immutable history; a NEW contract and ACTIVE_FUNDED qualification milestone are created for the same job, worker, and historical proposal. Requires the default-off surface, `admin_balance_hire:create`, claimed account, direct platform-admin status, Admin Pay allowlist, active canonical-admin-org membership (`OPENTRAIN_ADMIN_ORG_ID`), matching token organization, and same-organization target. Every check is fail-closed. ADMIN_BALANCE is the only implemented funding source. Active contracts, stale lineage, open money or a dispute on any contract of the job + worker (funded/unreleased milestones, milestones under review or with unresolved refunds, unsettled payouts, pending approvals, disputed time, timesheets awaiting review), and an ended contract whose tracker enrollment is neither revoked nor carried (`PROVIDER_OFFBOARDING_PENDING`, with `contractId` and `provider` only: a live, error-free membership on the path contract is carried onto the new contract instead, with zero provider calls, and the old offboarding leaves it alone; a pending, errored or uncarried one blocks; retry after the old offboarding confirms the revocation) fail closed with 409 `REHIRE_BLOCKED` and safe blocker metadata in `details.blockers[]`. A worker+job transaction lock plus generation-scoped receipts and deterministic artifact ids make concurrent and recovered retries converge. The canonical Job Messages conversation is reused and current new-hire Project To-dos/integrations are reconciled. Creation moves zero money; zero money moves during rehire, and later release remains human-only.",
        "parameters": [
          {
            "name": "contractIds",
            "in": "path",
            "required": true,
            "description": "Ended contract to chain the new generation from.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "milestone"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "fundingSource": {
                    "type": "string",
                    "enum": [
                      "ADMIN_BALANCE",
                      "CREDITS",
                      "CREDIT_CARD"
                    ],
                    "default": "ADMIN_BALANCE",
                    "description": "Only ADMIN_BALANCE is implemented; other values return 501."
                  },
                  "milestone": {
                    "type": "object",
                    "required": [
                      "description",
                      "amountUsd"
                    ],
                    "properties": {
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "description": {
                        "type": "string"
                      },
                      "amountUsd": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "dueDate": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay of the completed rehire generation (same closed shape; `onboarding` is recomputed live on every replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "jobId",
                    "priorContractId",
                    "contractId",
                    "milestone",
                    "fundingSource",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "releaseRequiresHumanApproval",
                    "jobConversation",
                    "provisioning",
                    "onboarding",
                    "carryOver",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "priorContractId": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "milestone": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "status",
                        "amountUsd",
                        "volume",
                        "fundingInvoiceId"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "ACTIVE_FUNDED after creation"
                        },
                        "amountUsd": {
                          "type": "number"
                        },
                        "volume": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "DEV-4500: funded hours when the hire recorded them."
                        },
                        "fundingInvoiceId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "fundingSource": {
                      "type": "string",
                      "enum": [
                        "ADMIN_BALANCE"
                      ]
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "releaseRequiresHumanApproval": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "jobConversation": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "conversationId",
                        "reused"
                      ],
                      "properties": {
                        "conversationId": {
                          "type": "string"
                        },
                        "reused": {
                          "type": "boolean"
                        }
                      }
                    },
                    "provisioning": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "projectTodos",
                        "integrations",
                        "eligibility"
                      ],
                      "description": "Legacy by-construction provisioning fields (projectTodos.queued, integrations, eligibility). Live onboarding truth is `onboarding`.",
                      "properties": {
                        "projectTodos": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "queued",
                            "workJobKey"
                          ],
                          "properties": {
                            "queued": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "workJobKey": {
                              "type": "string"
                            }
                          }
                        },
                        "integrations": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "engagement"
                          ],
                          "properties": {
                            "engagement": {
                              "type": "string",
                              "enum": [
                                "applied",
                                "not_applicable"
                              ]
                            }
                          }
                        },
                        "eligibility": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "reconciled"
                          ],
                          "properties": {
                            "reconciled": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "onboarding": {
                      "$ref": "#/components/schemas/NewHireOnboardingReceipt"
                    },
                    "carryOver": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "policy",
                        "policyVersion",
                        "priorContractId",
                        "contractId",
                        "items",
                        "humanActions"
                      ],
                      "properties": {
                        "policy": {
                          "type": "string",
                          "enum": [
                            "SUCCESSOR_CONTRACT"
                          ],
                          "description": "A rehire always creates a new contract; the ended one is never reopened."
                        },
                        "policyVersion": {
                          "type": "string",
                          "enum": [
                            "rehire-carry-over.v1"
                          ]
                        },
                        "priorContractId": {
                          "type": "string"
                        },
                        "contractId": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "category",
                              "disposition",
                              "reason"
                            ],
                            "properties": {
                              "category": {
                                "type": "string",
                                "enum": [
                                  "IDENTITY_LOCATION",
                                  "AGREEMENT",
                                  "LMS_COURSE",
                                  "INTEGRATION",
                                  "JOB_MESSAGES",
                                  "PROJECT_TODO"
                                ]
                              },
                              "disposition": {
                                "type": "string",
                                "enum": [
                                  "CARRIED",
                                  "RESET",
                                  "SKIPPED",
                                  "BLOCKED"
                                ],
                                "description": "CARRIED: reused on the new contract. RESET: the new contract starts it fresh (see reason). SKIPPED: nothing to carry. BLOCKED: not carried; a person must look."
                              },
                              "reason": {
                                "type": "string",
                                "enum": [
                                  "STILL_VALID",
                                  "SAME_VERSION_COMPLETED",
                                  "ENROLLMENT_LIVE",
                                  "THREAD_REUSED",
                                  "CHECK_EXPIRED",
                                  "CHECK_NOT_VERIFIED",
                                  "VERSION_CHANGED",
                                  "COURSE_VERSION_CHANGED",
                                  "PRIOR_NOT_COMPLETED",
                                  "PRIOR_WAIVED",
                                  "TYPE_NOT_PORTABLE",
                                  "ENROLLMENT_REVOKED",
                                  "MASTERY_RUNS_REQUIRED",
                                  "RETRAINING_CASE_OPEN",
                                  "CARRY_NOT_SUPPORTED",
                                  "NOT_REQUIRED",
                                  "NONE_TO_CARRY",
                                  "NOT_ASSIGNED_TO_NEW_HIRES",
                                  "ENGINE_MANAGED",
                                  "PROVIDER_STATE_UNCERTAIN"
                                ]
                              },
                              "priorRecordId": {
                                "type": "string"
                              },
                              "newRecordId": {
                                "type": "string"
                              },
                              "itemId": {
                                "type": "string"
                              },
                              "itemVersionId": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "humanActions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "WORKER_VERIFY_IDENTITY_OR_LOCATION",
                                  "WORKER_SIGN_AGREEMENT",
                                  "WORKER_ACCEPT_INTEGRATION_INVITE",
                                  "OPERATOR_REVIEW_PROVIDER_ENROLLMENT"
                                ]
                              },
                              "itemId": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Admin-balance rehire created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "jobId",
                    "priorContractId",
                    "contractId",
                    "milestone",
                    "fundingSource",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "releaseRequiresHumanApproval",
                    "jobConversation",
                    "provisioning",
                    "onboarding",
                    "carryOver",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "priorContractId": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "milestone": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "status",
                        "amountUsd",
                        "volume",
                        "fundingInvoiceId"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "ACTIVE_FUNDED after creation"
                        },
                        "amountUsd": {
                          "type": "number"
                        },
                        "volume": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "DEV-4500: funded hours when the hire recorded them."
                        },
                        "fundingInvoiceId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "fundingSource": {
                      "type": "string",
                      "enum": [
                        "ADMIN_BALANCE"
                      ]
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "releaseRequiresHumanApproval": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "jobConversation": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "conversationId",
                        "reused"
                      ],
                      "properties": {
                        "conversationId": {
                          "type": "string"
                        },
                        "reused": {
                          "type": "boolean"
                        }
                      }
                    },
                    "provisioning": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "projectTodos",
                        "integrations",
                        "eligibility"
                      ],
                      "description": "Legacy by-construction provisioning fields (projectTodos.queued, integrations, eligibility). Live onboarding truth is `onboarding`.",
                      "properties": {
                        "projectTodos": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "queued",
                            "workJobKey"
                          ],
                          "properties": {
                            "queued": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "workJobKey": {
                              "type": "string"
                            }
                          }
                        },
                        "integrations": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "engagement"
                          ],
                          "properties": {
                            "engagement": {
                              "type": "string",
                              "enum": [
                                "applied",
                                "not_applicable"
                              ]
                            }
                          }
                        },
                        "eligibility": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "reconciled"
                          ],
                          "properties": {
                            "reconciled": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    },
                    "onboarding": {
                      "$ref": "#/components/schemas/NewHireOnboardingReceipt"
                    },
                    "carryOver": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "policy",
                        "policyVersion",
                        "priorContractId",
                        "contractId",
                        "items",
                        "humanActions"
                      ],
                      "properties": {
                        "policy": {
                          "type": "string",
                          "enum": [
                            "SUCCESSOR_CONTRACT"
                          ],
                          "description": "A rehire always creates a new contract; the ended one is never reopened."
                        },
                        "policyVersion": {
                          "type": "string",
                          "enum": [
                            "rehire-carry-over.v1"
                          ]
                        },
                        "priorContractId": {
                          "type": "string"
                        },
                        "contractId": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "category",
                              "disposition",
                              "reason"
                            ],
                            "properties": {
                              "category": {
                                "type": "string",
                                "enum": [
                                  "IDENTITY_LOCATION",
                                  "AGREEMENT",
                                  "LMS_COURSE",
                                  "INTEGRATION",
                                  "JOB_MESSAGES",
                                  "PROJECT_TODO"
                                ]
                              },
                              "disposition": {
                                "type": "string",
                                "enum": [
                                  "CARRIED",
                                  "RESET",
                                  "SKIPPED",
                                  "BLOCKED"
                                ],
                                "description": "CARRIED: reused on the new contract. RESET: the new contract starts it fresh (see reason). SKIPPED: nothing to carry. BLOCKED: not carried; a person must look."
                              },
                              "reason": {
                                "type": "string",
                                "enum": [
                                  "STILL_VALID",
                                  "SAME_VERSION_COMPLETED",
                                  "ENROLLMENT_LIVE",
                                  "THREAD_REUSED",
                                  "CHECK_EXPIRED",
                                  "CHECK_NOT_VERIFIED",
                                  "VERSION_CHANGED",
                                  "COURSE_VERSION_CHANGED",
                                  "PRIOR_NOT_COMPLETED",
                                  "PRIOR_WAIVED",
                                  "TYPE_NOT_PORTABLE",
                                  "ENROLLMENT_REVOKED",
                                  "MASTERY_RUNS_REQUIRED",
                                  "RETRAINING_CASE_OPEN",
                                  "CARRY_NOT_SUPPORTED",
                                  "NOT_REQUIRED",
                                  "NONE_TO_CARRY",
                                  "NOT_ASSIGNED_TO_NEW_HIRES",
                                  "ENGINE_MANAGED",
                                  "PROVIDER_STATE_UNCERTAIN"
                                ]
                              },
                              "priorRecordId": {
                                "type": "string"
                              },
                              "newRecordId": {
                                "type": "string"
                              },
                              "itemId": {
                                "type": "string"
                              },
                              "itemVersionId": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "humanActions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "WORKER_VERIFY_IDENTITY_OR_LOCATION",
                                  "WORKER_SIGN_AGREEMENT",
                                  "WORKER_ACCEPT_INTEGRATION_INVITE",
                                  "OPERATOR_REVIEW_PROVIDER_ENROLLMENT"
                                ]
                              },
                              "itemId": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid idempotency key or milestone payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Fail-closed scope, actor, admin-org, or tenant authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Ended contract or proposal lineage not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Base is not ended or current; active contract, unresolved financial blocker, or pending provider offboarding (`REHIRE_BLOCKED`); idempotency conflict; a same-key replay of a rehire recorded before the carry-over report existed (`REHIRE_RECEIPT_PREDATES_CARRY_OVER`, naming `priorContractId` and the new `contractId`; nothing is written)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "501": {
            "description": "Requested funding source is not implemented",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/offboarding/preflight": {
      "post": {
        "tags": [
          "contract-offboarding"
        ],
        "summary": "Zero-write contract-offboarding plan (inventory + signed expected-state token)",
        "description": "DEV-3176 preflight. Inventories active milestones and pending money for settlement/final-close planning (never as access-offboarding blockers), open/submitted Project To-dos, LMS assignments, the EXACT canonical adapter-confirmable provider revocation targets (shared discovery with execution, including completed provider obligations whose external access still needs removal), every manual-first shared annotation-provider account, job channel memberships to be soft-removed, and the preserved Job Message history — then returns a signed plan token pinned to the COMPLETE reviewed teardown projection (financial + nonfinancial components). Strictly zero-write: no rows, no audit, no receipts. Read-authorized: `payments:read` suffices (`payments:write` implies read); only the confirm demands `payments:write`. Owner-only (DEV-3173): canonical contract access is checked FIRST (unknown/foreign contracts read as 404, so ids cannot be probed), then the caller must be the employer organization OWNER — an assigned or provider-authorized member with contract access receives a deterministic 403 with `details.reason` ORGANIZATION_OWNER_REQUIRED (ORGANIZATION_SCOPE_MISMATCH when an organization-scoped token names another organization); the platform-admin flag never bridges. Requires the default-off contract-offboarding surface.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The offboarding plan",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contractId",
                    "jobId",
                    "contractStatus",
                    "lifecycleStatus",
                    "automaticClose",
                    "participationState",
                    "settlementState",
                    "asOf",
                    "financial",
                    "time",
                    "projectTodos",
                    "training",
                    "integrations",
                    "annotationProvider",
                    "messaging",
                    "access",
                    "planToken",
                    "planTokenExpiresAt",
                    "moneyMoved"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contractStatus": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "ENDED"
                      ]
                    },
                    "lifecycleStatus": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "CLOSING",
                        "ENDED"
                      ],
                      "description": "CLOSING: access has ended and the contract closes when the money settles. ENDED: closed."
                    },
                    "automaticClose": {
                      "type": "object",
                      "required": [
                        "enabled",
                        "eligible"
                      ],
                      "properties": {
                        "enabled": {
                          "type": "boolean",
                          "description": "The automatic close is switched on for this deployment."
                        },
                        "eligible": {
                          "type": "boolean",
                          "description": "The contract can end by itself once nothing is open: fixed-price (or untyped on a fixed-price or untyped job) with no submitted or approved timesheet. Otherwise only the owner closes it."
                        }
                      },
                      "additionalProperties": false,
                      "description": "DEV-3066. When both are true, the contract ends by itself once nothing is open, and no payment can be added after it ends."
                    },
                    "participationState": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "OFFBOARDING",
                        "OFFBOARDED_PAYABLE",
                        "CLOSED",
                        "REACTIVATED"
                      ]
                    },
                    "settlementState": {
                      "type": "string",
                      "enum": [
                        "ACTION_REQUIRED",
                        "PROCESSING",
                        "SETTLED"
                      ]
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "financial": {
                      "type": "object",
                      "required": [
                        "milestones",
                        "blockers",
                        "pendingPayouts",
                        "pendingApprovals",
                        "requiresHumanCoSign",
                        "blocksOffboarding",
                        "blocksFinalClosure"
                      ],
                      "properties": {
                        "milestones": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "milestoneId",
                              "name",
                              "status",
                              "amountUsd",
                              "pendingApproval",
                              "needsReview",
                              "refundState",
                              "terminal"
                            ],
                            "properties": {
                              "milestoneId": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "amountUsd": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "pendingApproval": {
                                "type": "boolean"
                              },
                              "needsReview": {
                                "type": "boolean"
                              },
                              "refundState": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "terminal": {
                                "type": "boolean"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "blockers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "milestoneId",
                              "name",
                              "status",
                              "amountUsd",
                              "pendingApproval",
                              "needsReview",
                              "nextAction",
                              "nextActionMessage",
                              "actionUrl"
                            ],
                            "properties": {
                              "milestoneId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "amountUsd": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "pendingApproval": {
                                "type": "boolean"
                              },
                              "needsReview": {
                                "type": "boolean"
                              },
                              "nextAction": {
                                "type": "string"
                              },
                              "nextActionMessage": {
                                "type": "string"
                              },
                              "actionUrl": {
                                "type": "string",
                                "format": "uri",
                                "description": "Employer contract page where a signed-in owner resolves this milestone. It needs no approval row."
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "pendingPayouts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "milestoneId",
                              "status"
                            ],
                            "properties": {
                              "milestoneId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "pendingApprovals": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "approvalId",
                              "type",
                              "expiresAt",
                              "approvalUrl"
                            ],
                            "properties": {
                              "approvalId": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "expiresAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "approvalUrl": {
                                "type": "string",
                                "format": "uri",
                                "description": "Exact page where a signed-in human confirms or declines."
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "requiresHumanCoSign": {
                          "type": "boolean",
                          "enum": [
                            false
                          ],
                          "deprecated": true,
                          "description": "Compatibility field. Access offboarding never requires a financial co-sign."
                        },
                        "blocksOffboarding": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        },
                        "blocksFinalClosure": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    "time": {
                      "type": "object",
                      "required": [
                        "trackedTime",
                        "undecidedTimesheets",
                        "unavailable",
                        "blocksOffboarding"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "trackedTime": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "statementId",
                            "status",
                            "intervalStartAt",
                            "intervalEndAt",
                            "intervalEndProvisional",
                            "settledThroughAt",
                            "trackedSeconds",
                            "inputTrackedSeconds",
                            "activeSeconds",
                            "manualSeconds",
                            "deletedSeconds",
                            "activityCount",
                            "editEventCount",
                            "contentHash"
                          ],
                          "properties": {
                            "statementId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "SETTLING",
                                "READY_FOR_REVIEW",
                                "FINALIZED"
                              ]
                            },
                            "intervalStartAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "intervalEndAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "intervalEndProvisional": {
                              "type": "boolean"
                            },
                            "settledThroughAt": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "trackedSeconds": {
                              "type": "integer"
                            },
                            "inputTrackedSeconds": {
                              "type": "integer"
                            },
                            "activeSeconds": {
                              "type": "integer"
                            },
                            "manualSeconds": {
                              "type": "integer"
                            },
                            "deletedSeconds": {
                              "type": "integer"
                            },
                            "activityCount": {
                              "type": "integer"
                            },
                            "editEventCount": {
                              "type": "integer"
                            },
                            "contentHash": {
                              "type": "string"
                            }
                          },
                          "description": "Tracked time as the confirm final time statement would record it: same provider ledger, same calculation, no write. Null without final-only provider tracking. It can include hours that a submitted timesheet in `undecidedTimesheets` also counts, so do not add the two. Informational; it never blocks access removal."
                        },
                        "undecidedTimesheets": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "count",
                            "oldestWeekStart",
                            "newestWeekStart",
                            "trackedSeconds",
                            "manualSeconds",
                            "billableSeconds"
                          ],
                          "properties": {
                            "count": {
                              "type": "integer"
                            },
                            "oldestWeekStart": {
                              "type": "string",
                              "format": "date"
                            },
                            "newestWeekStart": {
                              "type": "string",
                              "format": "date"
                            },
                            "trackedSeconds": {
                              "type": "integer"
                            },
                            "manualSeconds": {
                              "type": "integer"
                            },
                            "billableSeconds": {
                              "type": "integer"
                            }
                          },
                          "description": "Submitted timesheets the owner has not approved or rejected yet, whatever the review mode: count, oldest and newest week, and summed tracked, manual and billable seconds. Null when there are none. On a contract with final-only provider tracking, the same hours can also be in `trackedTime`, so do not add the two. Informational; it never blocks access removal."
                        },
                        "unavailable": {
                          "type": "boolean"
                        },
                        "blocksOffboarding": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        }
                      }
                    },
                    "projectTodos": {
                      "type": "object",
                      "required": [
                        "nonterminal"
                      ],
                      "properties": {
                        "nonterminal": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "assignmentId",
                              "type",
                              "status",
                              "completionAuthority",
                              "provider"
                            ],
                            "properties": {
                              "assignmentId": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "completionAuthority": {
                                "type": "string"
                              },
                              "provider": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "training": {
                      "type": "object",
                      "required": [
                        "lmsAssignments"
                      ],
                      "properties": {
                        "lmsAssignments": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "assignmentId",
                              "type",
                              "status",
                              "completionAuthority",
                              "provider"
                            ],
                            "properties": {
                              "assignmentId": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "completionAuthority": {
                                "type": "string"
                              },
                              "provider": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "integrations": {
                      "type": "object",
                      "required": [
                        "adapterConfirmed"
                      ],
                      "properties": {
                        "adapterConfirmed": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "provider",
                              "assignmentId",
                              "revocationClass"
                            ],
                            "properties": {
                              "provider": {
                                "type": "string"
                              },
                              "assignmentId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "revocationClass": {
                                "type": "string",
                                "enum": [
                                  "ADAPTER_CONFIRMED",
                                  "NO_REVOCATION_REQUIRED",
                                  "MANUAL_REQUIRED",
                                  "CAPABILITY_UNDECLARED"
                                ],
                                "description": "The adapter-declared offboarding capability: local participation is revoked first; ADAPTER_CONFIRMED targets then require provider readback, NO_REVOCATION_REQUIRED targets are auditable no-revocation outcomes, and MANUAL_REQUIRED or CAPABILITY_UNDECLARED targets leave cleanup action required."
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "annotationProvider": {
                      "type": "object",
                      "required": [
                        "accounts"
                      ],
                      "properties": {
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "assignmentId",
                              "provider",
                              "status",
                              "revocationClass"
                            ],
                            "properties": {
                              "assignmentId": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "revocationClass": {
                                "type": "string",
                                "enum": [
                                  "MANUAL_PROVIDER_CLEANUP"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "messaging": {
                      "type": "object",
                      "required": [
                        "channelMembershipsToRemove",
                        "jobDmPreserved",
                        "historyPreserved",
                        "proposalsUntouched"
                      ],
                      "properties": {
                        "channelMembershipsToRemove": {
                          "type": "integer"
                        },
                        "jobDmPreserved": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "historyPreserved": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "proposalsUntouched": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "access": {
                      "type": "object",
                      "required": [
                        "hiredOnlyAccessEndsAtContractEnd",
                        "projectAccessEndsAtOffboardingStart",
                        "projectAccessRevokedBeforeCleanup"
                      ],
                      "properties": {
                        "hiredOnlyAccessEndsAtContractEnd": {
                          "type": "boolean",
                          "enum": [
                            true
                          ],
                          "deprecated": true,
                          "description": "Legacy alias retained for compatibility."
                        },
                        "projectAccessEndsAtOffboardingStart": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "projectAccessRevokedBeforeCleanup": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "planToken": {
                      "type": "string"
                    },
                    "planTokenExpiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing payments:read scope, or not the employer organization owner (details.reason ORGANIZATION_OWNER_REQUIRED | ORGANIZATION_SCOPE_MISMATCH)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found (unknown or foreign ids are not probeable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Provider offboarding configuration is unavailable (an operator must repair the provider organization mapping)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/offboarding/confirm": {
      "post": {
        "tags": [
          "contract-offboarding"
        ],
        "summary": "Execute the planned contract offboarding (fail-closed; no money moves)",
        "description": "DEV-3176 confirm. Requires a reason, client idempotency key, `confirm: true`, and the reviewed plan token. Owner-only (DEV-3173): canonical contract access is checked first, then the caller must be the employer organization OWNER; other members receive ORGANIZATION_OWNER_REQUIRED and organization-scoped tokens for another organization receive ORGANIZATION_SCOPE_MISMATCH. The first locked write moves participation to OFFBOARDING and revokes local project/channel access regardless of unsettled earned payments. Cleanup then converges Project To-dos, LMS access, adapter-confirmed providers, and manual annotation-provider steps with durable per-step success/failure evidence. A cleanup failure leaves access revoked in OFFBOARDING and a same-key retry resumes; success advances to OFFBOARDED_PAYABLE. History and earned-payment actions remain available while the contract is CLOSING (`lifecycleStatus`). Final CLOSED is blocked until settlement: when the preflight fields `automaticClose.enabled` and `automaticClose.eligible` are both true, the contract ends by itself once its last open payment settles, and no payment can be added after it ends; otherwise the owner calls the separate close endpoint (`POST /contracts/{contractId}/close`). Never sends chat, touches proposals, or moves money.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "reason",
                  "planToken",
                  "confirm"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "planToken": {
                    "type": "string"
                  },
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Offboarding executed (or idempotent replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contractId",
                    "jobId",
                    "status",
                    "participationState",
                    "lifecycleStatus",
                    "settlementState",
                    "contractEnded",
                    "endedAt",
                    "offboardedAt",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "approval",
                    "receipt",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "offboarded_payable"
                      ]
                    },
                    "participationState": {
                      "type": "string",
                      "enum": [
                        "OFFBOARDED_PAYABLE"
                      ]
                    },
                    "lifecycleStatus": {
                      "type": "string",
                      "enum": [
                        "CLOSING"
                      ]
                    },
                    "settlementState": {
                      "type": "string",
                      "enum": [
                        "ACTION_REQUIRED",
                        "PROCESSING",
                        "SETTLED"
                      ]
                    },
                    "contractEnded": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "endedAt": {
                      "type": "null"
                    },
                    "offboardedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "approval": {
                      "type": "null"
                    },
                    "receipt": {
                      "type": "object",
                      "required": [
                        "lifecycleState",
                        "finalTimeStatement",
                        "externalRevocations",
                        "projectTodos",
                        "training",
                        "annotationProvider",
                        "messaging",
                        "durableProviderOffboardingJobArmed",
                        "chatMessagesSent",
                        "proposalsModified"
                      ],
                      "properties": {
                        "lifecycleState": {
                          "type": "string",
                          "enum": [
                            "ENDED"
                          ],
                          "description": "Legacy provider/time-offboarding workflow state; this is not final financial closure."
                        },
                        "finalTimeStatement": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/TimeFinalStatement"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "externalRevocations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "provider",
                              "assignmentId",
                              "status"
                            ],
                            "properties": {
                              "provider": {
                                "type": "string"
                              },
                              "assignmentId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "confirmed_revoked",
                                  "no_revocation_required"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "projectTodos": {
                          "type": "object",
                          "required": [
                            "closedAssignmentIds",
                            "alreadyTerminal"
                          ],
                          "properties": {
                            "closedAssignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "alreadyTerminal": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "training": {
                          "type": "object",
                          "required": [
                            "closedLmsAssignmentIds"
                          ],
                          "properties": {
                            "closedLmsAssignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "annotationProvider": {
                          "type": "object",
                          "required": [
                            "status",
                            "assignmentIds",
                            "alreadyReleasedAssignmentIds",
                            "pendingManualSteps"
                          ],
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "started_manual_pending",
                                "none"
                              ]
                            },
                            "assignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "alreadyReleasedAssignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "pendingManualSteps": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "messaging": {
                          "type": "object",
                          "required": [
                            "channelMembershipsRemoved",
                            "historyPreserved",
                            "jobDmPreserved"
                          ],
                          "properties": {
                            "channelMembershipsRemoved": {
                              "type": "integer"
                            },
                            "historyPreserved": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "jobDmPreserved": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "durableProviderOffboardingJobArmed": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "chatMessagesSent": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        },
                        "proposalsModified": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Missing reason, plan token, idempotency key, or confirm: true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing payments:write, not the employer organization owner (details.reason ORGANIZATION_OWNER_REQUIRED | ORGANIZATION_SCOPE_MISMATCH), or unclaimed agent account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found (unknown or foreign ids are not probeable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already ended (first attempt); invalid/expired plan token; PLAN_STALE with driftedComponents; retryable phase failures (contract NOT ended; same-key retry resumes); in-progress or key-reuse conflicts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/lifecycle": {
      "get": {
        "tags": [
          "contract-offboarding"
        ],
        "summary": "Inspect contract participation, settlement, and cleanup state",
        "description": "Owner-only lifecycle inspection. Returns independent participation, settlement, cleanup, operation, and retry evidence without mutating the contract.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Contract lifecycle snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contractId",
                    "jobId",
                    "workerUserId",
                    "participationState",
                    "lifecycleStatus",
                    "participationRevision",
                    "settlementState",
                    "cleanupState",
                    "accessRevokedAt",
                    "closedAt",
                    "reactivatedAt",
                    "offboardingReason",
                    "financialBlockers",
                    "pendingPayoutCount",
                    "latestOperation"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workerUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "participationState": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "OFFBOARDING",
                        "OFFBOARDED_PAYABLE",
                        "CLOSED",
                        "REACTIVATED"
                      ]
                    },
                    "lifecycleStatus": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "CLOSING",
                        "ENDED"
                      ]
                    },
                    "participationRevision": {
                      "type": "integer"
                    },
                    "settlementState": {
                      "type": "string",
                      "enum": [
                        "ACTION_REQUIRED",
                        "PROCESSING",
                        "SETTLED"
                      ]
                    },
                    "cleanupState": {
                      "type": "string",
                      "enum": [
                        "NOT_STARTED",
                        "IN_PROGRESS",
                        "ACTION_REQUIRED",
                        "FAILED",
                        "COMPLETE"
                      ]
                    },
                    "accessRevokedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "closedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reactivatedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "offboardingReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "financialBlockers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "milestoneId",
                          "name",
                          "status",
                          "amountUsd",
                          "pendingApproval",
                          "needsReview",
                          "nextAction",
                          "nextActionMessage",
                          "actionUrl"
                        ],
                        "properties": {
                          "milestoneId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "amountUsd": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "pendingApproval": {
                            "type": "boolean"
                          },
                          "needsReview": {
                            "type": "boolean"
                          },
                          "nextAction": {
                            "type": "string"
                          },
                          "nextActionMessage": {
                            "type": "string"
                          },
                          "actionUrl": {
                            "type": "string",
                            "format": "uri",
                            "description": "Employer contract page where a signed-in owner resolves this milestone. It needs no approval row."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "pendingPayoutCount": {
                      "type": "integer"
                    },
                    "latestOperation": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "required": [
                        "id",
                        "type",
                        "status",
                        "startedAt",
                        "completedAt",
                        "errorCode",
                        "errorText",
                        "steps"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "OFFBOARD",
                            "RETRY_CLEANUP",
                            "CLOSE",
                            "REACTIVATE"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "RUNNING",
                            "SUCCEEDED",
                            "FAILED"
                          ]
                        },
                        "startedAt": {
                          "type": "string"
                        },
                        "completedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "errorCode": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "errorText": {
                          "type": "null",
                          "description": "Deprecated; always null. A stored error message can hold provider, database or personal text, so it is never returned. Read errorCode."
                        },
                        "steps": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "stepKey",
                              "status",
                              "attemptCount",
                              "lastAttemptAt",
                              "completedAt",
                              "errorCode",
                              "errorText",
                              "evidence"
                            ],
                            "properties": {
                              "stepKey": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "PENDING",
                                  "IN_PROGRESS",
                                  "SUCCEEDED",
                                  "FAILED",
                                  "MANUAL_ACTION"
                                ]
                              },
                              "attemptCount": {
                                "type": "integer"
                              },
                              "lastAttemptAt": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "completedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "errorCode": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "errorText": {
                                "type": "null",
                                "description": "Deprecated; always null. A stored error message can hold provider, database or personal text, so it is never returned. Read errorCode."
                              },
                              "evidence": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "description": "Closed projection of the step evidence: only the documented keys a lifecycle step writes. Keys a step did not write are absent.",
                                "properties": {
                                  "participationState": {
                                    "type": "string"
                                  },
                                  "channelMembershipsRemoved": {
                                    "type": "integer"
                                  },
                                  "historyPreserved": {
                                    "type": "boolean"
                                  },
                                  "jobDmPreserved": {
                                    "type": "boolean"
                                  },
                                  "membershipRestored": {
                                    "type": "boolean"
                                  },
                                  "skipped": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "projectMapIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "intervalEndAt": {
                                    "type": "string"
                                  },
                                  "statementId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "statementStatus": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "deferReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "projectMapId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "revocationFirstFailedAt": {
                                    "type": "string"
                                  },
                                  "selected": {
                                    "type": "integer"
                                  },
                                  "recreatedAssignments": {
                                    "type": "integer"
                                  },
                                  "provisionedAssignments": {
                                    "type": "integer"
                                  },
                                  "queuedAssignments": {
                                    "type": "integer"
                                  },
                                  "closedAssignmentIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "alreadyTerminalTodos": {
                                    "type": "integer"
                                  },
                                  "closedLmsAssignmentIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "startedAssignmentIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "alreadyReleasedAssignmentIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "pendingManualSteps": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "targets": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "required": [
                                        "provider",
                                        "outcome"
                                      ],
                                      "properties": {
                                        "provider": {
                                          "type": "string"
                                        },
                                        "assignmentId": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "offboardingCapability": {
                                          "type": "string"
                                        },
                                        "outcome": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "obligationClosed": {
                                          "type": "boolean"
                                        }
                                      },
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Missing payments:read, or not the employer organization owner (details.reason OWNER_REQUIRED | ORGANIZATION_SCOPE_MISMATCH when an organization-scoped token names another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/close": {
      "post": {
        "tags": [
          "contract-offboarding"
        ],
        "summary": "Finally close an offboarded contract after settlement",
        "description": "Owner-only final closure. Requires explicit confirm: true and is idempotent after CLOSED. The lifecycle lock serializes the final settlement checks with payout creation. Needed when the automatic close does not apply (preflight `automaticClose` not enabled or not eligible); an eligible contract can already have ended by itself (DEV-3066).",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "reason",
                  "confirm"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contract finally closed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Missing reason, idempotency key, or confirm: true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing payments:write, or not the employer organization owner (details.reason OWNER_REQUIRED | ORGANIZATION_SCOPE_MISMATCH when an organization-scoped token names another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Contract is not offboarded-payable or settlement is incomplete",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/reactivate": {
      "post": {
        "tags": [
          "contract-offboarding"
        ],
        "summary": "Reactivate project access on the same contract identity",
        "description": "Owner-only reactivation on the same contract identity. Requires explicit confirm: true and restores messaging, Project To-dos, training, and provider access behind lifecycle fences.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "reason",
                  "confirm"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contract participation reactivated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Missing reason, idempotency key, or confirm: true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing payments:write, or not the employer organization owner (details.reason OWNER_REQUIRED | ORGANIZATION_SCOPE_MISMATCH when an organization-scoped token names another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Lifecycle transition conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/milestones/{milestoneId}/review-flag/clear": {
      "post": {
        "tags": [
          "contract-offboarding"
        ],
        "summary": "Clear a stale review flag on a transferred milestone",
        "description": "DEV-3066 · Owner-only. Clears a stale review flag on one completed milestone whose payout is recorded, transferred and provider-verified. Only the milestone flag changes: no money moves, no invoice or payout delivery is written, and an audit record is kept. Refuses pending approvals, open refunds and OpenTrain-owned funding reviews (409 with details.notStaleReason). When the automatic close is enabled and the contract is eligible, and the clear settles the last blocker of a closing contract, the contract closes by itself (contractAutoClose: closed). With the automatic close enabled, a contract that has already ended reports already_closed and any other contract skipped; when the switch is off, or the milestone had no flag to clear, contractAutoClose is not_attempted.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "milestoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "reason",
                  "confirm"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Review flag cleared (or already clear)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "milestoneId",
                    "cleared",
                    "verifiedPayoutCount",
                    "moneyMoved",
                    "contractAutoClose",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "milestoneId": {
                      "type": "string"
                    },
                    "cleared": {
                      "type": "boolean"
                    },
                    "verifiedPayoutCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "contractAutoClose": {
                      "type": "string",
                      "enum": [
                        "closed",
                        "already_closed",
                        "skipped",
                        "not_attempted"
                      ]
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing reason, idempotency key, or confirm: true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing payments:write, or not the employer organization owner (details.reason OWNER_REQUIRED | ORGANIZATION_SCOPE_MISMATCH when an organization-scoped token names another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract or milestone not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The review flag is not stale, or a lifecycle conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messaging/management/messaging_management.members.list": {
      "get": {
        "tags": [
          "messaging-management"
        ],
        "summary": "Read conversation roster",
        "description": "Read a paginated roster without adding or repairing members. Requires messages:read, a claimed account, messaging rollout and canonical conversation access. Removed membership history is opt-in. Work addresses require includeWorkEmail and participant_work_email:read; signup addresses are never returned. Follow nextCursor until null.",
        "operationId": "listManagedMessagingMembers",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "conversationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "includeRemoved",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "includeWorkEmail",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read conversation roster",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "conversationId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contextType": {
                      "type": "string",
                      "enum": [
                        "proposal_dm",
                        "job_dm",
                        "channel"
                      ]
                    },
                    "channelName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ownerUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "includeRemoved": {
                      "type": "boolean"
                    },
                    "workEmailIncluded": {
                      "type": "boolean"
                    },
                    "members": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "conversationId": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          },
                          "displayLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "OWNER",
                              "ADMIN",
                              "MEMBER"
                            ]
                          },
                          "isOwner": {
                            "type": "boolean"
                          },
                          "membership": {
                            "type": "string",
                            "enum": [
                              "active",
                              "removed"
                            ]
                          },
                          "joinedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "removedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "canonical",
                              "legacy_mirror"
                            ]
                          },
                          "relationship": {
                            "type": "string",
                            "enum": [
                              "employer_owner",
                              "employer_member",
                              "freelancer",
                              "platform_admin",
                              "unknown"
                            ]
                          },
                          "contractId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "contractState": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "active",
                              "ended",
                              null
                            ]
                          },
                          "workEmail": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "conversationId",
                          "userId",
                          "displayLabel",
                          "role",
                          "isOwner",
                          "membership",
                          "joinedAt",
                          "removedAt",
                          "source",
                          "relationship",
                          "contractId",
                          "contractState"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "conversationId": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          },
                          "displayLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "OWNER",
                              "ADMIN",
                              "MEMBER"
                            ]
                          },
                          "isOwner": {
                            "type": "boolean"
                          },
                          "membership": {
                            "type": "string",
                            "enum": [
                              "active",
                              "removed"
                            ]
                          },
                          "joinedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "removedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "canonical",
                              "legacy_mirror"
                            ]
                          },
                          "relationship": {
                            "type": "string",
                            "enum": [
                              "employer_owner",
                              "employer_member",
                              "freelancer",
                              "platform_admin",
                              "unknown"
                            ]
                          },
                          "contractId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "contractState": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "active",
                              "ended",
                              null
                            ]
                          },
                          "workEmail": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "conversationId",
                          "userId",
                          "displayLabel",
                          "role",
                          "isOwner",
                          "membership",
                          "joinedAt",
                          "removedAt",
                          "source",
                          "relationship",
                          "contractId",
                          "contractState"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "required": [
                    "conversationId",
                    "jobId",
                    "contextType",
                    "channelName",
                    "ownerUserId",
                    "includeRemoved",
                    "workEmailIncluded",
                    "members",
                    "items",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid selector, filter, page size, or bound cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, job, or membership access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Target not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Managed work-email read rate limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messaging/management/messaging_management.members.get": {
      "get": {
        "tags": [
          "messaging-management"
        ],
        "summary": "Inspect conversation membership",
        "description": "Inspect exactly one userId, contractId or managed workEmail selector and channel add/remove eligibility without changing membership. Requires messages:read and current conversation access; managed-address use requires participant_work_email:read. Unknown/nonmember selectors return membership none, not a directory lookup. Preflight is observational; explicit add/remove operations reauthorize.",
        "operationId": "getManagedMessagingMember",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "conversationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "workEmail",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            }
          },
          {
            "name": "includeWorkEmail",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect conversation membership",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "conversationId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contextType": {
                      "type": "string",
                      "enum": [
                        "proposal_dm",
                        "job_dm",
                        "channel"
                      ]
                    },
                    "selector": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "userId",
                            "contractId",
                            "workEmail"
                          ]
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "membership": {
                      "type": "string",
                      "enum": [
                        "active",
                        "removed",
                        "none"
                      ]
                    },
                    "member": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "conversationId": {
                              "type": "string"
                            },
                            "userId": {
                              "type": "string"
                            },
                            "displayLabel": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "OWNER",
                                "ADMIN",
                                "MEMBER"
                              ]
                            },
                            "isOwner": {
                              "type": "boolean"
                            },
                            "membership": {
                              "type": "string",
                              "enum": [
                                "active",
                                "removed"
                              ]
                            },
                            "joinedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "removedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "canonical",
                                "legacy_mirror"
                              ]
                            },
                            "relationship": {
                              "type": "string",
                              "enum": [
                                "employer_owner",
                                "employer_member",
                                "freelancer",
                                "platform_admin",
                                "unknown"
                              ]
                            },
                            "contractId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "contractState": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "enum": [
                                "active",
                                "ended",
                                null
                              ]
                            },
                            "workEmail": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "conversationId",
                            "userId",
                            "displayLabel",
                            "role",
                            "isOwner",
                            "membership",
                            "joinedAt",
                            "removedAt",
                            "source",
                            "relationship",
                            "contractId",
                            "contractState"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "actorCanManage": {
                              "type": "boolean"
                            },
                            "canAdd": {
                              "type": "boolean"
                            },
                            "canRemove": {
                              "type": "boolean"
                            },
                            "blockers": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "eligibility": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "eligible": {
                                      "type": "boolean"
                                    },
                                    "retryable": {
                                      "type": "boolean"
                                    },
                                    "reason": {
                                      "type": "string",
                                      "enum": [
                                        "eligible_active_hire",
                                        "eligible_assigned_employer",
                                        "hire_state_propagating",
                                        "contract_ended",
                                        "user_banned",
                                        "account_closed",
                                        "user_not_found",
                                        "not_assigned_to_job"
                                      ]
                                    },
                                    "retryAfterSeconds": {
                                      "type": [
                                        "integer",
                                        "null"
                                      ],
                                      "minimum": 0
                                    }
                                  },
                                  "required": [
                                    "eligible",
                                    "retryable",
                                    "reason",
                                    "retryAfterSeconds"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "actorCanManage",
                            "canAdd",
                            "canRemove",
                            "blockers",
                            "eligibility"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "required": [
                    "conversationId",
                    "jobId",
                    "contextType",
                    "selector",
                    "membership",
                    "member",
                    "preflight",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid selector, filter, page size, or bound cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, job, or membership access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Target not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Managed work-email read rate limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messaging/management/messaging_management.conversations.list": {
      "get": {
        "tags": [
          "messaging-management"
        ],
        "summary": "Read job conversations",
        "description": "List one authorized job’s separate proposal DMs, Job DMs and channels with participants and response evidence. Requires messages:read, claimed account, messaging rollout and employer job access. Follow nextCursor until null. updatedAfter filters conversation-row changes, not a complete message-edit feed. needsEmployerReply is organization-level response evidence, not proof of issue resolution. Never creates, merges or repairs conversations.",
        "operationId": "listJobConversations",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "contextType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "proposal_dm",
                "job_dm",
                "channel"
              ]
            }
          },
          {
            "name": "participantUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "updatedAfter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "needsEmployerReply",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read job conversations",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "employerOrganizationUserIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "conversations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "conversationId": {
                            "type": "string"
                          },
                          "contextType": {
                            "type": "string",
                            "enum": [
                              "proposal_dm",
                              "job_dm",
                              "channel"
                            ]
                          },
                          "jobId": {
                            "type": "string"
                          },
                          "proposalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "channelName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "participants": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "userId": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "relationship": {
                                  "type": "string",
                                  "enum": [
                                    "employer_owner",
                                    "employer_member",
                                    "freelancer",
                                    "platform_admin",
                                    "unknown"
                                  ]
                                }
                              },
                              "required": [
                                "userId",
                                "displayName",
                                "relationship"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "counterpart": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "userId": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "userId",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "contract": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "active",
                                      "ended"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "needsEmployerReply": {
                            "type": "boolean"
                          },
                          "latestActivityAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "latestMessage": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "messageId": {
                                    "type": "string"
                                  },
                                  "senderUserId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "threadId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "messageId",
                                  "senderUserId",
                                  "createdAt",
                                  "threadId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "latestWorkerMessage": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "messageId": {
                                    "type": "string"
                                  },
                                  "senderUserId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "threadId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "messageId",
                                  "senderUserId",
                                  "createdAt",
                                  "threadId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "latestEmployerResponse": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "messageId": {
                                    "type": "string"
                                  },
                                  "senderUserId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "threadId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "messageId",
                                  "senderUserId",
                                  "createdAt",
                                  "threadId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "conversationId",
                          "contextType",
                          "jobId",
                          "proposalId",
                          "channelName",
                          "participants",
                          "counterpart",
                          "contract",
                          "needsEmployerReply",
                          "latestActivityAt",
                          "updatedAt",
                          "latestMessage",
                          "latestWorkerMessage",
                          "latestEmployerResponse"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "conversationId": {
                            "type": "string"
                          },
                          "contextType": {
                            "type": "string",
                            "enum": [
                              "proposal_dm",
                              "job_dm",
                              "channel"
                            ]
                          },
                          "jobId": {
                            "type": "string"
                          },
                          "proposalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "channelName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "participants": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "userId": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "relationship": {
                                  "type": "string",
                                  "enum": [
                                    "employer_owner",
                                    "employer_member",
                                    "freelancer",
                                    "platform_admin",
                                    "unknown"
                                  ]
                                }
                              },
                              "required": [
                                "userId",
                                "displayName",
                                "relationship"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "counterpart": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "userId": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "userId",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "contract": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "active",
                                      "ended"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "needsEmployerReply": {
                            "type": "boolean"
                          },
                          "latestActivityAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "latestMessage": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "messageId": {
                                    "type": "string"
                                  },
                                  "senderUserId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "threadId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "messageId",
                                  "senderUserId",
                                  "createdAt",
                                  "threadId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "latestWorkerMessage": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "messageId": {
                                    "type": "string"
                                  },
                                  "senderUserId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "threadId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "messageId",
                                  "senderUserId",
                                  "createdAt",
                                  "threadId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "latestEmployerResponse": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "messageId": {
                                    "type": "string"
                                  },
                                  "senderUserId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "threadId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "messageId",
                                  "senderUserId",
                                  "createdAt",
                                  "threadId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "conversationId",
                          "contextType",
                          "jobId",
                          "proposalId",
                          "channelName",
                          "participants",
                          "counterpart",
                          "contract",
                          "needsEmployerReply",
                          "latestActivityAt",
                          "updatedAt",
                          "latestMessage",
                          "latestWorkerMessage",
                          "latestEmployerResponse"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "required": [
                    "asOf",
                    "jobId",
                    "employerOrganizationUserIds",
                    "conversations",
                    "items",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid selector, filter, page size, or bound cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, job, or membership access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Target not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Managed work-email read rate limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messaging/management/{operation}": {
      "get": {
        "tags": [
          "messaging-management"
        ],
        "summary": "Read managed messaging resources",
        "description": "Requires `messages:read`, a claimed account, the default-off messaging-management surface, and canonical job/conversation access. Reads never create or mutate conversations.",
        "operationId": "listManagedMessagingResources",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "operation",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "messaging_management.channels.list",
                "messaging_management.threads.list",
                "messaging_management.members.list",
                "messaging_management.members.get",
                "messaging_management.conversations.list"
              ]
            }
          },
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cursor-paged channels or threads",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, job, or membership access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Conversation or job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "messaging-management"
        ],
        "summary": "Apply an idempotent managed messaging mutation",
        "description": "Requires `messages:manage`, a claimed account, the default-off messaging-management surface, canonical membership/role authorization, and a required `Idempotency-Key`. `messaging_management.messages.send` additionally requires `messages:write`, exactly one conversationId or contractId, a complete jobOperationsGuard, and an Idempotency-Key matching `^[A-Za-z0-9._:-]{8,128}$`; OpenTrain resolves the canonical direct-job or proposal→job binding after message authorization, commits the message and context advance atomically, and returns idempotent replays with one fresh sync envelope. All operations are desired-state or append-only and preserve proposal-DM, job-DM, and channel lifecycle boundaries. Member adds accept active hires and assigned employer teammates; a recent hire whose contract read is still propagating returns 409 with `details.reason=CHANNEL_MEMBER_ELIGIBILITY_PROPAGATING`, `retryable=true`, and `retryAfterSeconds`, while permanent eligibility failures return `CHANNEL_MEMBER_INELIGIBLE` with per-member reasons. `messaging_management.members.add` takes `{conversationId, userId}` or `{conversationId, userIds: [...]}` (up to 100 ids, all or nothing) and returns `userIds` plus per-user `members[]`; an archived channel answers 409 `channel_archived`. `messaging_management.channels.update` takes `{conversationId, name?, autoAddNewHires?}` with at least one setting (channel owner). `messaging_management.channels.archive` and `messaging_management.channels.unarchive` take `{conversationId}` (channel owner): an archived channel stays readable for members but refuses new messages (409 `channel_archived`) and adds no new hires; archiving the job's default team chat (`jobDefaultChannel=true`) also stops a new default chat being created, and unarchiving it resumes adding new hires. Channel summaries carry `archived`, `archivedAt`, `jobDefaultChannel` and `autoAddNewHires`.",
        "operationId": "applyManagedMessagingMutation",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "operation",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "messaging_management.channels.create",
                "messaging_management.channels.rename",
                "messaging_management.channels.update",
                "messaging_management.channels.archive",
                "messaging_management.channels.unarchive",
                "messaging_management.members.add",
                "messaging_management.members.remove",
                "messaging_management.members.leave",
                "messaging_management.ownership.transfer",
                "messaging_management.threads.reply",
                "messaging_management.messages.send",
                "messaging_management.reactions.add",
                "messaging_management.reactions.remove",
                "messaging_management.pins.set",
                "messaging_management.moderation.apply"
              ]
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Stable retry key bound to the operation, principal, and payload. For messaging_management.messages.send the exact contract is 8-128 characters matching ^[A-Za-z0-9._:-]{8,128}$."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mutation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "replayed",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "replayed": {
                      "type": "boolean"
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid operation payload or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, membership, or role denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Target not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict/in-progress request, retryable recent-hire propagation, permanent channel-member ineligibility, or a stale jobOperationsGuard (reason JOB_OPS_STALE_REVISION / JOB_OPS_ACTION_STATE); or the work-coordination refusal — details = JobOpsWorkCoordinationConflictDetails {reason: JOB_OPS_WORK_COORDINATION_REQUIRED, requirement: WORK_EXECUTION_REQUIRED | DEFINED_WORK_REQUIRED | MODE_UNREADABLE, mode}.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "details": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/JobOpsWorkCoordinationConflictDetails"
                            },
                            {
                              "type": "object",
                              "description": "Ordinary conflict details (e.g. reason STALE_REVISION + currentRevision, or none).",
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "not": {
                                    "enum": [
                                      "JOB_OPS_WORK_COORDINATION_REQUIRED"
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/project-todos": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "List project to-dos (employer or worker view, pageable)",
        "description": "Requires `project_todos:read`, the default-off project-todos agent surface, and a claimed account. Pass `jobId` for the employer view (flat `items`, compatibility `categories`, roster without emails, assignments, and summary) or `contractId` for an EXACT contract read: a worker gets their own effective list + history and blocking state; an employer gets exactly that contract's assignments in every status (SCHEDULED rows carry activation diagnostics), a `people` roster of ONE (the requested contract's worker, even when the contract is ended, offboarded, or closed; empty when the contract has no linked worker), the job catalog with contract-scoped `progress`, and the `contract` lifecycle projection (`contract` is null on job-wide reads and never names any other contract). `assignedTo` is the employer alias for `contractId` (requires `jobId`). A `jobId` supplied with a contract selector must match the contract's job for workers and employers alike — a mismatch is rejected with `BAD_REQUEST` plus `details.reason: 'CONTRACT_JOB_MISMATCH'` (only after the caller is known to hold the contract or its job) and never widens the read. `needsReview=true` selects submitted work, and `includeArchived=true` includes archived catalog records. Disabled jobs read as `enabled: false` with an empty, inert surface — history is retained but not exposed (the exact read still returns `contract` and its single `people` entry). Cursor-paged with stable assignment ids; `nextCursor` signals continuation so nothing truncates silently. `limit` above the documented maximum of 100 is rejected with `BAD_REQUEST` plus `details.reason: 'INVALID_PAGE_SIZE'` and the documented `maxLimit`/`defaultLimit`; to collect a complete job, follow `nextCursor` at a valid page size (the CLI `todos list --all` and the MCP `all: true` input do this for you and report `{pageSize, pagesFetched, collectedCount, complete, finalCursor}`).",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "description": "Exact contract read: worker view for the contract holder; for employers exactly this contract (roster of one, all statuses, `contract` lifecycle projection). Never widens to the job roster.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "IN_PROGRESS",
                "SUBMITTED",
                "COMPLETED",
                "RETURNED",
                "WAIVED",
                "CLOSED",
                "SUPERSEDED"
              ]
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assignedTo",
            "in": "query",
            "required": false,
            "description": "Employer alias for `contractId` (requires `jobId`, which must match the contract). Resolves the same exact contract read.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "needsReview",
            "in": "query",
            "required": false,
            "description": "When true, return only SUBMITTED assignments.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "description": "Employer catalog only: include archived categories and items.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Project to-do list page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "view",
                    "enabled",
                    "contract",
                    "categories",
                    "items",
                    "people",
                    "assignments",
                    "summary",
                    "nextCursor",
                    "totalCount",
                    "holds",
                    "sync",
                    "syncCoverage"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "view": {
                      "type": "string",
                      "enum": [
                        "employer",
                        "worker"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contractId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contract": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "DEV-2833: lifecycle projection of the REQUESTED contract on contract-selected reads (employer exact read and worker read); null on job-wide reads. Deliberately lean — never names sibling, prior, or successor contracts.",
                      "required": [
                        "contractId",
                        "jobId",
                        "proposalId",
                        "participationState",
                        "currentAccess",
                        "endLifecycleState",
                        "createdAt",
                        "startedAt",
                        "endedAt",
                        "reactivatedAt",
                        "rosterMembership",
                        "exclusionReason",
                        "worker"
                      ],
                      "properties": {
                        "contractId": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "proposalId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "participationState": {
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "OFFBOARDING",
                            "OFFBOARDED_PAYABLE",
                            "CLOSED",
                            "REACTIVATED"
                          ]
                        },
                        "currentAccess": {
                          "type": "boolean",
                          "description": "True when participationState is ACTIVE or REACTIVATED."
                        },
                        "endLifecycleState": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "ACTIVE",
                            "END_REQUESTED",
                            "OFFBOARDING",
                            "ENDED",
                            null
                          ],
                          "description": "Stored contract-end lifecycle state; null only for absent or unrecognized legacy data."
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "startedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "endedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "reactivatedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "rosterMembership": {
                          "type": "string",
                          "enum": [
                            "ACTIVE_ROSTER",
                            "EXCLUDED"
                          ],
                          "description": "ACTIVE_ROSTER = would appear in the job-wide `people` roster."
                        },
                        "exclusionReason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "OFFBOARDING",
                            "OFFBOARDED_PAYABLE",
                            "CONTRACT_CLOSED",
                            "CONTRACT_ENDED",
                            "NO_WORKER",
                            null
                          ]
                        },
                        "worker": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "description": "The requested worker only; masked like the roster, never an email. Null when the contract has no linked worker — a name is never synthesized from the contract display snapshot or job title.",
                          "required": [
                            "userId",
                            "displayName"
                          ],
                          "properties": {
                            "userId": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "categories": {
                      "type": "array",
                      "description": "Compatibility grouping for employer views. Prefer the flat `items` collection for agent parsing.",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "items": {
                      "type": "array",
                      "description": "Flat logical To-do definitions; empty for worker views.",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "people": {
                      "type": "array",
                      "description": "Employer view only. Worker emails are never included. Exactly one entry (the requested contract’s worker) on the exact contract read, or none when that contract has no linked worker.",
                      "items": {
                        "type": "object",
                        "required": [
                          "contractId",
                          "displayName",
                          "assignmentCount"
                        ],
                        "properties": {
                          "contractId": {
                            "type": "string"
                          },
                          "userId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "assignmentCount": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "blocking": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Worker view only: whether open worker-court obligations gate project work / provider access.",
                      "additionalProperties": true
                    },
                    "assignments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "One tracked obligation: stable id, status (SCHEDULED | OPEN | IN_PROGRESS | SUBMITTED | COMPLETED | RETURNED | WAIVED | CLOSED | SUPERSEDED — SCHEDULED is the gated pre-activation state), waiting role, activatedAt (null while gated; due/blocking anchor here), schedule, immutable item version snapshot (including its activationRule), typed evidence, the append-only event audit history, and — on employer views of SCHEDULED rows — an `activation` diagnostics block with the rule, live per-predicate evaluation, and (DEV-2832) `activation.hold` — the ACTIVE per-person hold keeping the row closed, with its reason, release rule and live release-rule evaluation — explaining exactly why the work is waiting. Worker views never contain never-activated work.",
                        "additionalProperties": true
                      }
                    },
                    "summary": {
                      "type": "object",
                      "required": [
                        "itemCount",
                        "archivedItemCount",
                        "assignmentCount",
                        "openCount",
                        "completedCount",
                        "needsReviewCount",
                        "returnedCount"
                      ],
                      "properties": {
                        "itemCount": {
                          "type": "integer"
                        },
                        "archivedItemCount": {
                          "type": "integer"
                        },
                        "assignmentCount": {
                          "type": "integer"
                        },
                        "openCount": {
                          "type": "integer"
                        },
                        "completedCount": {
                          "type": "integer"
                        },
                        "needsReviewCount": {
                          "type": "integer"
                        },
                        "returnedCount": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": false
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "totalCount": {
                      "type": "integer"
                    },
                    "holds": {
                      "type": "array",
                      "description": "DEV-2832: per-person holds of the job (employer views only; empty for workers) — the readback for who is excluded from what, why, and what releases it. ACTIVE holds first, then released ones, newest first, at most 500. The exact contract read returns only that person’s holds.",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "jobId",
                          "itemId",
                          "status",
                          "subject",
                          "reason",
                          "releaseRule",
                          "createdAt",
                          "createdByUserId",
                          "releasedAt",
                          "releasedByUserId",
                          "releaseTrigger",
                          "releaseReason",
                          "currentAssignment",
                          "releasePredicates"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "jobId": {
                            "type": "string"
                          },
                          "itemId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "RELEASED"
                            ]
                          },
                          "subject": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "workerUserId",
                              "contractId",
                              "proposalId",
                              "displayName"
                            ],
                            "properties": {
                              "workerUserId": {
                                "type": "string",
                                "description": "Opaque person key the hold is bound to."
                              },
                              "contractId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "proposalId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "displayName": {
                                "type": "string",
                                "description": "Masked \"First L.\" — never an email."
                              }
                            }
                          },
                          "reason": {
                            "type": "string"
                          },
                          "releaseRule": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "schemaVersion",
                              "mode",
                              "predicates"
                            ],
                            "properties": {
                              "schemaVersion": {
                                "type": "integer",
                                "enum": [
                                  1
                                ]
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "ALL",
                                  "ANY"
                                ]
                              },
                              "predicates": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 10,
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "kind",
                                        "itemId"
                                      ],
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "todo_completed"
                                          ]
                                        },
                                        "itemId": {
                                          "type": "string"
                                        },
                                        "satisfaction": {
                                          "type": "string",
                                          "enum": [
                                            "COMPLETED_ONLY",
                                            "COMPLETED_OR_WAIVED"
                                          ]
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "kind",
                                        "anchor",
                                        "offsetMinutes"
                                      ],
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "after_delay"
                                          ]
                                        },
                                        "anchor": {
                                          "type": "string",
                                          "enum": [
                                            "ASSIGNED",
                                            "CONTRACT_START"
                                          ]
                                        },
                                        "offsetMinutes": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 525600
                                        }
                                      }
                                    }
                                  ]
                                }
                              }
                            }
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "createdByUserId": {
                            "type": "string"
                          },
                          "releasedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "releasedByUserId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "releaseTrigger": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "MANUAL",
                              "RULE_SATISFIED",
                              "ACTIVATION_OVERRIDE",
                              null
                            ]
                          },
                          "releaseReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currentAssignment": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "status",
                              "activatedAt"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "activatedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            }
                          },
                          "releasePredicates": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "predicate",
                                "satisfied",
                                "satisfiedByAssignmentId",
                                "maturesAt",
                                "detail"
                              ],
                              "properties": {
                                "predicate": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "kind",
                                        "itemId"
                                      ],
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "todo_completed"
                                          ]
                                        },
                                        "itemId": {
                                          "type": "string"
                                        },
                                        "satisfaction": {
                                          "type": "string",
                                          "enum": [
                                            "COMPLETED_ONLY",
                                            "COMPLETED_OR_WAIVED"
                                          ]
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "kind",
                                        "anchor",
                                        "offsetMinutes"
                                      ],
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "after_delay"
                                          ]
                                        },
                                        "anchor": {
                                          "type": "string",
                                          "enum": [
                                            "ASSIGNED",
                                            "CONTRACT_START"
                                          ]
                                        },
                                        "offsetMinutes": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 525600
                                        }
                                      }
                                    }
                                  ]
                                },
                                "satisfied": {
                                  "type": "boolean"
                                },
                                "satisfiedByAssignmentId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "maturesAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time"
                                },
                                "detail": {
                                  "type": "string",
                                  "enum": [
                                    "SATISFIED",
                                    "DELAY_PENDING",
                                    "DELAY_ANCHOR_MISSING",
                                    "PREREQUISITE_NOT_FINISHED",
                                    "PREREQUISITE_NOT_ASSIGNED"
                                  ]
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing jobId/contractId or unknown cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, agent surface disabled, unclaimed account, or foreign job/contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/availability": {
      "get": {
        "operationId": "project_todos.availability.status",
        "tags": [
          "project-todos"
        ],
        "summary": "Read job work-availability status",
        "description": "Employer-only, job-scoped status for the fixed rolling-seven-day work-availability module. Reports whether Project To-dos are enabled, whether the canonical item exists, the saved project reporting time zone (or explicit UTC fallback), and asked/responded counts. Names, emails, and schedules are not returned. Requires `project_todos:read`, a claimed account, job access, and the project-todos agent surface.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Project work-availability status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "asOf",
                    "projectTodosEnabled",
                    "item",
                    "reportingTimeZone",
                    "windowStartDate",
                    "windowEndDate",
                    "counts"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "projectTodosEnabled": {
                      "type": "boolean"
                    },
                    "item": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "itemId",
                            "versionId",
                            "schemaVersion",
                            "scheduleKey",
                            "windowDays",
                            "title"
                          ],
                          "properties": {
                            "itemId": {
                              "type": "string"
                            },
                            "versionId": {
                              "type": "string"
                            },
                            "schemaVersion": {
                              "type": "integer",
                              "enum": [
                                1
                              ]
                            },
                            "scheduleKey": {
                              "type": "string",
                              "enum": [
                                "ROLLING_7_DAY_AVAILABILITY"
                              ]
                            },
                            "windowDays": {
                              "type": "integer",
                              "enum": [
                                7
                              ]
                            },
                            "title": {
                              "type": "string"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reportingTimeZone": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "timeZone",
                        "source"
                      ],
                      "properties": {
                        "timeZone": {
                          "type": "string",
                          "description": "Resolved IANA time-zone identifier."
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "query",
                            "job",
                            "default"
                          ]
                        }
                      }
                    },
                    "windowStartDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "windowEndDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "counts": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "activeContracts",
                        "asked",
                        "awaitingFirstSchedule",
                        "withCoveringSchedule",
                        "notAsked"
                      ],
                      "properties": {
                        "activeContracts": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "asked": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "awaitingFirstSchedule": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "withCoveringSchedule": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "notAsked": {
                          "type": "integer",
                          "minimum": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid jobId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "More than one active work-availability item exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/availability/schedule": {
      "get": {
        "operationId": "project_todos.availability.schedule.read",
        "tags": [
          "project-todos"
        ],
        "summary": "Read standardized job work-availability schedules",
        "description": "Employer-only rolling current-day-plus-six schedule read. Time-zone precedence is an optional query override, then the job saved project reporting zone, then UTC; `timeZoneSource` always reports which won. `coverage` returns count-only day/hour heatmap cells. `people` returns a maximum of 50 active same-job contracts per page using masked display names, assignment state, and UTC plus localized ranges. Personal emails and user ids never leave this endpoint. Requires `project_todos:read`, a claimed account, job access, and the project-todos agent surface.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "coverage",
                "people"
              ],
              "default": "coverage"
            }
          },
          {
            "name": "timeZone",
            "in": "query",
            "required": false,
            "description": "Read-only IANA time-zone override; it does not update the job.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "granularity",
            "in": "query",
            "required": false,
            "description": "Coverage view only.",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "hour"
              ],
              "default": "hour"
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "description": "People view only; comma-separated list of up to 50 exact same-job active contract ids.",
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": false
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Coverage or paged people schedule",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "jobId",
                        "asOf",
                        "view",
                        "timeZone",
                        "timeZoneSource",
                        "windowStartDate",
                        "windowEndDate",
                        "activeContracts",
                        "days"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "asOf": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "view": {
                          "type": "string",
                          "enum": [
                            "coverage"
                          ]
                        },
                        "timeZone": {
                          "type": "string"
                        },
                        "timeZoneSource": {
                          "type": "string",
                          "enum": [
                            "query",
                            "job",
                            "default"
                          ]
                        },
                        "windowStartDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "windowEndDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "activeContracts": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "days": {
                          "type": "array",
                          "minItems": 7,
                          "maxItems": 7,
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "required": [
                              "localDate",
                              "startAt",
                              "endAt",
                              "counts",
                              "intensity"
                            ],
                            "properties": {
                              "localDate": {
                                "type": "string",
                                "format": "date"
                              },
                              "startAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "endAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "counts": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "available",
                                  "unavailable",
                                  "unknown",
                                  "notAssigned",
                                  "active"
                                ],
                                "properties": {
                                  "available": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "unavailable": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "unknown": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "notAssigned": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "active": {
                                    "type": "integer",
                                    "minimum": 0
                                  }
                                }
                              },
                              "intensity": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 4
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "jobId",
                        "asOf",
                        "view",
                        "timeZone",
                        "timeZoneSource",
                        "windowStartDate",
                        "windowEndDate",
                        "people",
                        "nextCursor",
                        "totalCount"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "asOf": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "view": {
                          "type": "string",
                          "enum": [
                            "people"
                          ]
                        },
                        "timeZone": {
                          "type": "string"
                        },
                        "timeZoneSource": {
                          "type": "string",
                          "enum": [
                            "query",
                            "job",
                            "default"
                          ]
                        },
                        "windowStartDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "windowEndDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "people": {
                          "type": "array",
                          "maxItems": 50,
                          "description": "Masked worker names and job-contract ids only; never personal emails or user ids.",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "totalCount": {
                          "type": "integer",
                          "minimum": 0
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid zone, view/filter combination, page size, or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/availability/manage": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "summary": "Enable, assign, or configure job work availability",
        "description": "`enable` turns on Project To-dos and creates or adopts exactly one fixed-schema work-availability item while assigning zero workers. `preflight_assignment` is strictly no-write/read-scoped and returns the shared signed Project To-do audience receipt. `assign` delegates to the canonical Project To-do fan-out/future-hire engine; broad audiences require that receipt. `set_timezone` changes the job project reporting IANA zone independently of enablement and supports compare-and-set. Mutations require an `Idempotency-Key` header that exactly matches body `idempotencyKey` plus `project_todos:write`; preflight requires `project_todos:read` and no idempotency key. All actions require a claimed employer account, exact job access, and the project-todos agent surface.",
        "x-opentrain-operation-ids": [
          "project_todos.availability.enable",
          "project_todos.availability.assignment.preflight",
          "project_todos.availability.assign",
          "project_todos.availability.timezone.set"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "jobId",
                      "idempotencyKey"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "enable"
                        ]
                      },
                      "jobId": {
                        "type": "string"
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 200
                      },
                      "reportingTimeZone": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "jobId",
                      "audience"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "preflight_assignment"
                        ]
                      },
                      "jobId": {
                        "type": "string"
                      },
                      "audience": {
                        "type": "string",
                        "enum": [
                          "ACTIVE",
                          "FUTURE",
                          "ACTIVE_AND_FUTURE",
                          "SELECTED"
                        ]
                      },
                      "selectedContractIds": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "jobId",
                      "idempotencyKey",
                      "audience"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "assign"
                        ]
                      },
                      "jobId": {
                        "type": "string"
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 200
                      },
                      "audience": {
                        "type": "string",
                        "enum": [
                          "ACTIVE",
                          "FUTURE",
                          "ACTIVE_AND_FUTURE",
                          "SELECTED"
                        ]
                      },
                      "selectedContractIds": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "string"
                        }
                      },
                      "preflightReceipt": {
                        "type": "string",
                        "minLength": 16,
                        "maxLength": 8192
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "action",
                      "jobId",
                      "idempotencyKey",
                      "timeZone"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "set_timezone"
                        ]
                      },
                      "jobId": {
                        "type": "string"
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 200
                      },
                      "timeZone": {
                        "type": "string"
                      },
                      "expectedCurrentTimeZone": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Action-specific availability result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid action payload or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim, rollout, or job access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, stale time-zone fence, missing enablement, ambiguous item, or stale preflight receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/manage": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "summary": "Create, update, assign, activate, reorder, transition, or review a project to-do",
        "description": "Requires `project_todos:write` (except `preflight` and `activation_preview`, which need only `project_todos:read`), the default-off project-todos agent surface, and a claimed account. One discriminated `action` union: `preflight` (no-write preview of create_item / update_item / assign / archive_item / set_future_assignment — masked recipients, exact current/future counts, projected due/blocking, duplicate candidates, provider-specific recipient decisions and side effects, and the signed request-bound receipt required by broad/provider assignments and future-policy changes), `set_enabled` (employer opt-in switch; disabling requires active integrations off first), `create_category`, `create_item` (immutable version definition + audience fan-out; `audience` is REQUIRED — ACTIVE / FUTURE / ACTIVE_AND_FUTURE additionally require `preflightReceipt`, SELECTED requires a non-empty duplicate-free list of active same-job contract ids and never auto-assigns future hires; an exact duplicate of an active item is refused unless `allowDuplicate: true`), `update_item` (publishes a new immutable version; optional `assign` reissues it, superseding stale open obligations; broad reissue requires `preflightReceipt`), `archive_item` (closes open assignments with exact counts returned, history retained, irreversible), `assign` (re-run for reassignment; broad audiences and provider-owned setup assignments require `preflightReceipt`; provider decisions preserve unfinished/resolved assignments and invite only first-time or closed recipients — a version GATED by an activationRule fans out SCHEDULED assignments instead: worker-invisible, unscheduled, and provider-dormant until activation), `set_future_assignment` (changes only future-hire auto-assignment after an exact no-write preview; it never fans out immediately), `activation_preview` (STRICTLY NO-WRITE, keyless: predicted OPEN vs SCHEDULED per contract for an item’s current rule or a draft rule, with per-predicate diagnostics and missing-prerequisite warnings), `activate` (audited employer override: forces one SCHEDULED assignment OPEN now with a required reason; the deferred provider side effect fires at activation; converges with alreadyActive if evaluation won), `reorder_items` (display order only — never a prerequisite; orderedItemIds must be exactly the category’s non-archived items), `hold_preview` (STRICTLY NO-WRITE, keyless, read-scope: for one item and the named contracts/proposals, what a per-person hold would do for each of them now — HELD_AT_HIRE / HELD_PENDING_ASSIGNMENT / HELD / ALREADY_ACTIVE / RESOLVED — plus the live evaluation of the optional draft releaseRule and warnings; nobody else appears), `hold` (DEV-2832 per-person hold: while ACTIVE, every assignment of the item created for each named person — a manual fan-out or the hire-time future-hire auto-assignment — is born SCHEDULED, worker-invisible and provider-dormant, until the hold is released by `release_hold`, by the audited `activate` override, or automatically when `releaseRule` is satisfied, e.g. the LMS course to-do COMPLETED after a system-verified PASS; a hold never changes anyone else’s obligations and never re-locks an already-activated assignment — reason required, one ACTIVE hold per item and person, idempotent per key), `release_hold` (resume: each ACTIVE hold of the item for the named people becomes RELEASED with the audited reason and the held assignment is re-evaluated at once — it opens unless the version’s own activation rule still waits), `worker_transition` (VIEW / START / COMPLETE / SUBMIT with optional typed evidence — worker-court only; every worker action on a never-activated assignment is rejected), and `review` (APPROVE completes, RETURN rejects with a correction request, WAIVE is the audited admin override, CLOSE revokes; reason required for RETURN/WAIVE/CLOSE — WAIVE/CLOSE also cancel a SCHEDULED gate pre-activation, permanently worker-invisible). Every mutating action requires `idempotencyKey` (min 8 chars) bound to the complete canonical request: a replay of the same key with the same payload converges, the same key with a different payload returns `409`. Provider-completed (INTEGRATION_ACTION) items cannot be completed by attestation — only a provider-verified fact completes them, and never while SCHEDULED.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "action"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "preflight",
                      "set_enabled",
                      "create_category",
                      "create_item",
                      "update_item",
                      "archive_item",
                      "assign",
                      "set_future_assignment",
                      "activation_preview",
                      "activate",
                      "reorder_items",
                      "hold_preview",
                      "hold",
                      "release_hold",
                      "worker_transition",
                      "review"
                    ]
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "jobId": {
                    "type": "string"
                  },
                  "operation": {
                    "type": "string",
                    "enum": [
                      "create_item",
                      "update_item",
                      "assign",
                      "archive_item",
                      "set_future_assignment"
                    ]
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "set_enabled module state or set_future_assignment exact future-hire policy state."
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "categoryId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "audience": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "FUTURE",
                      "ACTIVE_AND_FUTURE",
                      "SELECTED"
                    ],
                    "description": "Required for create_item and assign. There is no default: omitting audience is a validation error, never a silent fan-out to active contracts."
                  },
                  "selectedContractIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "autoAssignNewHires": {
                    "type": "boolean"
                  },
                  "preflightReceipt": {
                    "type": "string",
                    "minLength": 16,
                    "maxLength": 8192,
                    "description": "Required for broad/provider assignments and set_future_assignment; must match the exact reviewed request."
                  },
                  "allowDuplicate": {
                    "type": "boolean"
                  },
                  "version": {
                    "type": "object",
                    "description": "Immutable version definition: title, type (MANUAL_ACTION | READ_ACKNOWLEDGE | EXTERNAL_ACTION | EMPLOYER_REVIEW | QUIZ | TRAINING | PLATFORM_REQUIREMENT | INTEGRATION_ACTION), priority, blockingMode/blockingScope, dueOffsetMinutes, completionConfig (actionUrl must be absolute http(s); INTEGRATION_ACTION requires provider), and optional activationRule (schemaVersion 1, mode ALL|ANY, predicates todo_completed {itemId, satisfaction COMPLETED_ONLY default | COMPLETED_OR_WAIVED opt-in} / after_delay {anchor ASSIGNED|CONTRACT_START, offsetMinutes 1..525600}). A gated version births assignments SCHEDULED: worker-invisible, no due/blocking, and provider items stay DORMANT (no invite/provisioning) until activation. Prerequisites must reference non-archived same-job items; cycles are rejected. On update_item an omitted activationRule keeps the current rule; send null to remove it.",
                    "additionalProperties": true
                  },
                  "itemId": {
                    "type": "string"
                  },
                  "rule": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": true,
                    "description": "activation_preview: draft activation rule to preview before publishing (omit to preview the itemId current rule)."
                  },
                  "orderedItemIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "reorder_items: the category's complete non-archived item id set, in display order (display only — never a prerequisite)."
                  },
                  "subjects": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "hold_preview / hold / release_hold (DEV-2832): the PEOPLE the hold names — contracts of the job (hired) and/or proposals of the job (not hired yet; the hold then binds the hire-time auto-assignment). At least one id, at most 100 in total; every id must belong to this job, a contract must be a live participant with a worker, a proposal must have a candidate — otherwise 400 INVALID_HOLD_SUBJECTS names each offender and nothing is held.",
                    "properties": {
                      "contractIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "maxItems": 100
                      },
                      "proposalIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "maxItems": 100
                      }
                    }
                  },
                  "releaseRule": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": false,
                    "required": [
                      "schemaVersion",
                      "mode",
                      "predicates"
                    ],
                    "properties": {
                      "schemaVersion": {
                        "type": "integer",
                        "enum": [
                          1
                        ]
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "ALL",
                          "ANY"
                        ]
                      },
                      "predicates": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 10,
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "kind",
                                "itemId"
                              ],
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "todo_completed"
                                  ]
                                },
                                "itemId": {
                                  "type": "string"
                                },
                                "satisfaction": {
                                  "type": "string",
                                  "enum": [
                                    "COMPLETED_ONLY",
                                    "COMPLETED_OR_WAIVED"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "kind",
                                "anchor",
                                "offsetMinutes"
                              ],
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "after_delay"
                                  ]
                                },
                                "anchor": {
                                  "type": "string",
                                  "enum": [
                                    "ASSIGNED",
                                    "CONTRACT_START"
                                  ]
                                },
                                "offsetMinutes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 525600
                                }
                              }
                            }
                          ]
                        }
                      }
                    },
                    "description": "hold_preview / hold: optional automatic release condition in the activation-rule shape, e.g. {\"schemaVersion\":1,\"mode\":\"ALL\",\"predicates\":[{\"kind\":\"todo_completed\",\"itemId\":\"<LMS course to-do item>\"}]} — the LMS to-do completes only from the system-verified PASS, so the held to-do opens by itself after the pass (WAIVED does not count under the default COMPLETED_ONLY). Prerequisites must be non-archived same-job items (never the held item itself). Omit or null = manual release only."
                  },
                  "assign": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": true
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "assignmentId": {
                    "type": "string"
                  },
                  "transition": {
                    "type": "string",
                    "enum": [
                      "VIEW",
                      "START",
                      "COMPLETE",
                      "SUBMIT"
                    ]
                  },
                  "evidence": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": true
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "RETURN",
                      "WAIVE",
                      "CLOSE"
                    ]
                  }
                },
                "allOf": [
                  {
                    "if": {
                      "not": {
                        "properties": {
                          "action": {
                            "enum": [
                              "preflight",
                              "activation_preview",
                              "hold_preview"
                            ]
                          }
                        },
                        "required": [
                          "action"
                        ]
                      }
                    },
                    "then": {
                      "required": [
                        "idempotencyKey"
                      ]
                    }
                  },
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "const": "activate"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    "then": {
                      "required": [
                        "assignmentId",
                        "reason"
                      ]
                    }
                  },
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "const": "hold_preview"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    "then": {
                      "required": [
                        "jobId",
                        "itemId",
                        "subjects"
                      ]
                    }
                  },
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "enum": [
                            "hold",
                            "release_hold"
                          ]
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    "then": {
                      "required": [
                        "idempotencyKey",
                        "jobId",
                        "itemId",
                        "subjects",
                        "reason"
                      ]
                    }
                  },
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "const": "reorder_items"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    "then": {
                      "required": [
                        "jobId",
                        "categoryId",
                        "orderedItemIds"
                      ]
                    }
                  },
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "const": "create_item"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    "then": {
                      "required": [
                        "audience"
                      ]
                    }
                  },
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "const": "assign"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    "then": {
                      "required": [
                        "audience"
                      ]
                    }
                  },
                  {
                    "if": {
                      "properties": {
                        "action": {
                          "const": "set_future_assignment"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    "then": {
                      "required": [
                        "idempotencyKey",
                        "jobId",
                        "itemId",
                        "enabled",
                        "preflightReceipt"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Action result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "action",
                    "ok"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "action": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "category": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "itemId": {
                      "type": "string"
                    },
                    "versionId": {
                      "type": "string"
                    },
                    "fanOut": {
                      "type": "object",
                      "properties": {
                        "matchedContracts": {
                          "type": "integer"
                        },
                        "createdAssignments": {
                          "type": "integer"
                        },
                        "assignmentIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "reconciledEquivalentAssignments": {
                          "type": "integer",
                          "description": "DEV-2919: matched recipients whose LATEST non-superseded exact-version assignment came from a different operation and was adopted untouched (no new occurrence, supersession, notification, or provider side effect)."
                        },
                        "outcomes": {
                          "type": "array",
                          "description": "DEV-2919: exactly one truthful outcome per matched recipient, anchored on the latest non-superseded exact-version assignment. CREATED = row created by this call; PRESERVED = same-operation-key replay (id stays in assignmentIds for replay-safe provisioning); RECONCILED = latest exact-version row from a different operation adopted untouched; POLICY_PRESERVED = item-scoped one-time-setup preservation of a different-version assignment. RECONCILED and POLICY_PRESERVED ids are excluded from assignmentIds.",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "contractId",
                              "assignmentId",
                              "outcome",
                              "status"
                            ],
                            "properties": {
                              "contractId": {
                                "type": "string"
                              },
                              "assignmentId": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": "string",
                                "enum": [
                                  "CREATED",
                                  "PRESERVED",
                                  "RECONCILED",
                                  "POLICY_PRESERVED"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "SCHEDULED",
                                  "OPEN",
                                  "IN_PROGRESS",
                                  "SUBMITTED",
                                  "COMPLETED",
                                  "RETURNED",
                                  "WAIVED",
                                  "CLOSED",
                                  "SUPERSEDED"
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    "provisioning": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "providerSetup": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true,
                      "description": "Provider-owned setup preview: masked recipient decisions, exclusions, and exact invite/preservation side effects."
                    },
                    "futureAssignment": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true,
                      "description": "Previewed or committed future-hire assignment policy before/after state."
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "assignment": {
                      "type": "object",
                      "description": "One tracked obligation: stable id, status (SCHEDULED | OPEN | IN_PROGRESS | SUBMITTED | COMPLETED | RETURNED | WAIVED | CLOSED | SUPERSEDED — SCHEDULED is the gated pre-activation state), waiting role, activatedAt (null while gated; due/blocking anchor here), schedule, immutable item version snapshot (including its activationRule), typed evidence, the append-only event audit history, and — on employer views of SCHEDULED rows — an `activation` diagnostics block with the rule, live per-predicate evaluation, and (DEV-2832) `activation.hold` — the ACTIVE per-person hold keeping the row closed, with its reason, release rule and live release-rule evaluation — explaining exactly why the work is waiting. Worker views never contain never-activated work.",
                      "additionalProperties": true
                    },
                    "activationPreview": {
                      "type": "object",
                      "description": "activation_preview: the evaluated rule plus one row per matched contract (masked displayName, predicted OPEN vs SCHEDULED, per-predicate satisfied/unmet with detail SATISFIED | DELAY_PENDING | DELAY_ANCHOR_MISSING | PREREQUISITE_NOT_FINISHED | PREREQUISITE_NOT_ASSIGNED — DELAY_ANCHOR_MISSING means a CONTRACT_START delay fails closed because the contract has no canonical start date, and DEV-2832 `hold`: the ACTIVE per-person hold that keeps the contract SCHEDULED regardless of the rule, with its reason, release rule and live release-rule evaluation, or null) and warnings — including missing-prerequisite fan-outs that would wait indefinitely.",
                      "additionalProperties": true
                    },
                    "activation": {
                      "type": "object",
                      "description": "activate: override outcome. alreadyActive=true means automatic rule evaluation won the race and the call converged without a second activation.",
                      "properties": {
                        "assignmentId": {
                          "type": "string"
                        },
                        "activated": {
                          "type": "boolean"
                        },
                        "alreadyActive": {
                          "type": "boolean"
                        },
                        "status": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "reorder": {
                      "type": "object",
                      "description": "reorder_items: the committed display order (display only).",
                      "properties": {
                        "categoryId": {
                          "type": "string"
                        },
                        "orderedItemIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "holds": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "itemId",
                        "releaseRule",
                        "rows",
                        "warnings"
                      ],
                      "description": "DEV-2832 hold_preview / hold / release_hold: one row per named person. effect (previews and hold): HELD_AT_HIRE — not hired yet, the future-hire fan-out will create the assignment SCHEDULED; HELD_PENDING_ASSIGNMENT — contract but no live assignment, the next fan-out is born SCHEDULED; HELD — a SCHEDULED assignment now also waits for the hold; ALREADY_ACTIVE — an activated copy exists, activation is one-way, no live effect (warning); RESOLVED — already completed/waived. outcome: CREATED | ALREADY_HELD (hold), RELEASED | NOT_HELD (release_hold), null (preview). releasePredicates: live evaluation of the release rule for the person (empty before the hire or without a rule). Nobody else is affected.",
                      "properties": {
                        "itemId": {
                          "type": "string"
                        },
                        "releaseRule": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "additionalProperties": false,
                          "required": [
                            "schemaVersion",
                            "mode",
                            "predicates"
                          ],
                          "properties": {
                            "schemaVersion": {
                              "type": "integer",
                              "enum": [
                                1
                              ]
                            },
                            "mode": {
                              "type": "string",
                              "enum": [
                                "ALL",
                                "ANY"
                              ]
                            },
                            "predicates": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 10,
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "kind",
                                      "itemId"
                                    ],
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "todo_completed"
                                        ]
                                      },
                                      "itemId": {
                                        "type": "string"
                                      },
                                      "satisfaction": {
                                        "type": "string",
                                        "enum": [
                                          "COMPLETED_ONLY",
                                          "COMPLETED_OR_WAIVED"
                                        ]
                                      }
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "kind",
                                      "anchor",
                                      "offsetMinutes"
                                    ],
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "after_delay"
                                        ]
                                      },
                                      "anchor": {
                                        "type": "string",
                                        "enum": [
                                          "ASSIGNED",
                                          "CONTRACT_START"
                                        ]
                                      },
                                      "offsetMinutes": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 525600
                                      }
                                    }
                                  }
                                ]
                              }
                            }
                          }
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "subject",
                              "effect",
                              "outcome",
                              "holdId",
                              "currentAssignment",
                              "releasePredicates"
                            ],
                            "properties": {
                              "subject": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "workerUserId",
                                  "contractId",
                                  "proposalId",
                                  "displayName"
                                ],
                                "properties": {
                                  "workerUserId": {
                                    "type": "string",
                                    "description": "Opaque person key the hold is bound to."
                                  },
                                  "contractId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "proposalId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "displayName": {
                                    "type": "string",
                                    "description": "Masked \"First L.\" — never an email."
                                  }
                                }
                              },
                              "effect": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "HELD_AT_HIRE",
                                  "HELD_PENDING_ASSIGNMENT",
                                  "HELD",
                                  "ALREADY_ACTIVE",
                                  "RESOLVED",
                                  null
                                ]
                              },
                              "outcome": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "CREATED",
                                  "ALREADY_HELD",
                                  "RELEASED",
                                  "NOT_HELD",
                                  null
                                ]
                              },
                              "holdId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "currentAssignment": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "status",
                                  "activatedAt"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "activatedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  }
                                }
                              },
                              "releasePredicates": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "predicate",
                                    "satisfied",
                                    "satisfiedByAssignmentId",
                                    "maturesAt",
                                    "detail"
                                  ],
                                  "properties": {
                                    "predicate": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "kind",
                                            "itemId"
                                          ],
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "todo_completed"
                                              ]
                                            },
                                            "itemId": {
                                              "type": "string"
                                            },
                                            "satisfaction": {
                                              "type": "string",
                                              "enum": [
                                                "COMPLETED_ONLY",
                                                "COMPLETED_OR_WAIVED"
                                              ]
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "additionalProperties": false,
                                          "required": [
                                            "kind",
                                            "anchor",
                                            "offsetMinutes"
                                          ],
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "after_delay"
                                              ]
                                            },
                                            "anchor": {
                                              "type": "string",
                                              "enum": [
                                                "ASSIGNED",
                                                "CONTRACT_START"
                                              ]
                                            },
                                            "offsetMinutes": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 525600
                                            }
                                          }
                                        }
                                      ]
                                    },
                                    "satisfied": {
                                      "type": "boolean"
                                    },
                                    "satisfiedByAssignmentId": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "maturesAt": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "format": "date-time"
                                    },
                                    "detail": {
                                      "type": "string",
                                      "enum": [
                                        "SATISFIED",
                                        "DELAY_PENDING",
                                        "DELAY_ANCHOR_MISSING",
                                        "PREREQUISITE_NOT_FINISHED",
                                        "PREREQUISITE_NOT_ASSIGNED"
                                      ]
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid action payload or state transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, agent surface disabled, unclaimed account, or wrong role for the action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job, item, or assignment not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Project To-dos disabled, idempotency-key conflict, terminal assignment, or active integration blocks disabling",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/export-csv": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "Export project to-dos as CSV",
        "description": "Requires `project_todos:read`, the default-off project-todos agent surface, and a claimed account. Returns the canonical spreadsheet-formula-neutralized CSV inside a JSON envelope. The `worker_email` column is redacted on agent surfaces — personal emails never leave the platform.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV export envelope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jobId",
                    "asOf",
                    "filename",
                    "csv",
                    "rowCount",
                    "redactions"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "csv": {
                      "type": "string"
                    },
                    "rowCount": {
                      "type": "integer"
                    },
                    "redactions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, agent surface disabled, or foreign job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Project To-dos are disabled for this job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/forms": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "List the canonical quiz/form library for one job",
        "description": "Lists job-local Native Forms and quizzes. Requires `project_todos:read`, the default-off project-todos agent surface, and a claimed account; DEVICE tokens are rejected. A row whose stored draft is grounded on a draft preview of the Instructions (`draftDefinitionJson.grounding.source: draft_preview`) carries `previewLabel`; no other row has the key.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job quiz/form library",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jobId",
                    "forms"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "forms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "createdAt",
                          "updatedAt",
                          "ownerOrganizationId",
                          "scopeJobId",
                          "title",
                          "description",
                          "descriptionDocJson",
                          "draftDefinitionJson",
                          "draftSettingsJson",
                          "draftRevision",
                          "createOperationKeyText",
                          "createRequestHashText",
                          "createdByUserId",
                          "archivedAt",
                          "versions"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          },
                          "ownerOrganizationId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "scopeJobId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "descriptionDocJson": {
                            "anyOf": [
                              {
                                "type": "object",
                                "description": "TipTap rich document (extensible; validated in depth by the server).",
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "draftDefinitionJson": {
                            "type": "object",
                            "description": "The stored form definition JSON (questions, options, answer keys, grounding): open by design, validated on write.",
                            "additionalProperties": {}
                          },
                          "draftSettingsJson": {
                            "type": "object",
                            "description": "The stored form settings JSON (attempt policy, pass rule, result release, authoring decision): open by design, validated on write.",
                            "additionalProperties": {}
                          },
                          "draftRevision": {
                            "type": "integer"
                          },
                          "createOperationKeyText": {
                            "type": "string"
                          },
                          "createRequestHashText": {
                            "type": "string"
                          },
                          "createdByUserId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "archivedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "previewLabel": {
                            "type": "string",
                            "description": "Only on a draft grounded on a draft preview of the Instructions (`draftDefinitionJson.grounding.source` is `draft_preview`): the label to show. Publish refuses it (409 GROUNDING_DRAFT_PREVIEW) until the Instructions are released and the grounding is re-captured."
                          },
                          "versions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "required": [
                                "id",
                                "publishedAt",
                                "formId",
                                "versionNumber",
                                "title",
                                "description",
                                "descriptionDocJson",
                                "definitionJson",
                                "settingsJson",
                                "totalPoints",
                                "contentHashText",
                                "sourceDraftRevision",
                                "publishOperationKeyText",
                                "publishedByUserId",
                                "_count"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "publishedAt": {
                                  "type": "string"
                                },
                                "formId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "versionNumber": {
                                  "type": "integer"
                                },
                                "title": {
                                  "type": "string"
                                },
                                "description": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "descriptionDocJson": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "description": "TipTap rich document (extensible; validated in depth by the server).",
                                      "additionalProperties": {}
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "definitionJson": {
                                  "type": "object",
                                  "description": "The stored form definition JSON (questions, options, answer keys, grounding): open by design, validated on write.",
                                  "additionalProperties": {}
                                },
                                "settingsJson": {
                                  "type": "object",
                                  "description": "The stored form settings JSON (attempt policy, pass rule, result release, authoring decision): open by design, validated on write.",
                                  "additionalProperties": {}
                                },
                                "totalPoints": {
                                  "type": "integer"
                                },
                                "contentHashText": {
                                  "type": "string"
                                },
                                "sourceDraftRevision": {
                                  "type": "integer"
                                },
                                "publishOperationKeyText": {
                                  "type": "string"
                                },
                                "publishedByUserId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "_count": {
                                  "type": "object",
                                  "required": [
                                    "todoBindings",
                                    "attempts"
                                  ],
                                  "properties": {
                                    "todoBindings": {
                                      "type": "integer"
                                    },
                                    "attempts": {
                                      "type": "integer"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or surface disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found: another organization's job, a job the caller cannot access and a missing job are one indistinguishable 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/forms/{formId}": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "Get one canonical job-local quiz/form including draft and versions",
        "description": "Requires `project_todos:read`, the default-off project-todos agent surface, and a claimed employer account with access to the form’s job. DEVICE tokens are rejected. When the stored draft is grounded on a draft preview of the Instructions (`draftDefinitionJson.grounding.source: draft_preview`), the form carries `previewLabel`; publish refuses that draft until the Instructions are released and the grounding is re-captured.",
        "parameters": [
          {
            "name": "formId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quiz/form detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "createdAt",
                    "updatedAt",
                    "ownerOrganizationId",
                    "scopeJobId",
                    "title",
                    "description",
                    "descriptionDocJson",
                    "draftDefinitionJson",
                    "draftSettingsJson",
                    "draftRevision",
                    "createOperationKeyText",
                    "createRequestHashText",
                    "createdByUserId",
                    "archivedAt",
                    "versions",
                    "scopeJob"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    },
                    "ownerOrganizationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "scopeJobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "descriptionDocJson": {
                      "anyOf": [
                        {
                          "type": "object",
                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draftDefinitionJson": {
                      "type": "object",
                      "description": "The stored form definition JSON (questions, options, answer keys, grounding): open by design, validated on write.",
                      "additionalProperties": {}
                    },
                    "draftSettingsJson": {
                      "type": "object",
                      "description": "The stored form settings JSON (attempt policy, pass rule, result release, authoring decision): open by design, validated on write.",
                      "additionalProperties": {}
                    },
                    "draftRevision": {
                      "type": "integer"
                    },
                    "createOperationKeyText": {
                      "type": "string"
                    },
                    "createRequestHashText": {
                      "type": "string"
                    },
                    "createdByUserId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "archivedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "previewLabel": {
                      "type": "string",
                      "description": "Only on a draft grounded on a draft preview of the Instructions (`draftDefinitionJson.grounding.source` is `draft_preview`): the label to show. Publish refuses it (409 GROUNDING_DRAFT_PREVIEW) until the Instructions are released and the grounding is re-captured."
                    },
                    "versions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "publishedAt",
                          "formId",
                          "versionNumber",
                          "title",
                          "description",
                          "descriptionDocJson",
                          "definitionJson",
                          "settingsJson",
                          "totalPoints",
                          "contentHashText",
                          "sourceDraftRevision",
                          "publishOperationKeyText",
                          "publishedByUserId"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "publishedAt": {
                            "type": "string"
                          },
                          "formId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "versionNumber": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "descriptionDocJson": {
                            "anyOf": [
                              {
                                "type": "object",
                                "description": "TipTap rich document (extensible; validated in depth by the server).",
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "definitionJson": {
                            "type": "object",
                            "description": "The stored form definition JSON (questions, options, answer keys, grounding): open by design, validated on write.",
                            "additionalProperties": {}
                          },
                          "settingsJson": {
                            "type": "object",
                            "description": "The stored form settings JSON (attempt policy, pass rule, result release, authoring decision): open by design, validated on write.",
                            "additionalProperties": {}
                          },
                          "totalPoints": {
                            "type": "integer"
                          },
                          "contentHashText": {
                            "type": "string"
                          },
                          "sourceDraftRevision": {
                            "type": "integer"
                          },
                          "publishOperationKeyText": {
                            "type": "string"
                          },
                          "publishedByUserId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "scopeJob": {
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "id",
                            "jobtitleText"
                          ],
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "jobtitleText": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign form",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/code": {
      "get": {
        "operationId": "projectTodoQuizCodeExport",
        "tags": [
          "project-todos"
        ],
        "summary": "Export a quiz draft or published version as the portable quiz-as-code document",
        "description": "Registry op `project_todos.quizzes.code.export` (read scope, keyless). Returns the `opentrainQuizVersion: 1` document — exactly the authoring content (title, description, optional rich description, settings, definition with the author’s stable question/option ids), never ids, timestamps, scope, revisions, assets or attempts — plus the source reference, the PORTABLE `contentHash` (over the document’s content, without the server-owned authoringDecision; NOT the hash a publication records) and, for a published version, the `recordedContentHash` the publication stored. Import it back with `form_import`; a form from another organization reads as 404.",
        "parameters": [
          {
            "name": "formId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Export this published version instead of the current draft (must belong to the form)."
          }
        ],
        "responses": {
          "200": {
            "description": "Quiz-as-code document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "formId",
                    "scopeJobId",
                    "source",
                    "draftRevision",
                    "formVersionId",
                    "versionNumber",
                    "contentHash",
                    "recordedContentHash",
                    "exportedAt",
                    "document"
                  ],
                  "properties": {
                    "formId": {
                      "type": "string"
                    },
                    "scopeJobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "VERSION"
                      ]
                    },
                    "draftRevision": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "formVersionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "versionNumber": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "contentHash": {
                      "type": "string",
                      "description": "The PORTABLE content hash: hashNativeFormPublication over the document’s content (settings without the server-owned authoringDecision, the definition as stored). It identifies portable content across export → edit → import; it is NOT the hash a publication records (publishing prunes uncited grounding pins and refreshes the tree checksum, and a stored authoringDecision is part of the recorded settings) — see recordedContentHash."
                    },
                    "recordedContentHash": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The hash the publication recorded (VERSION sources); null for a draft."
                    },
                    "exportedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "document": {
                      "type": "object",
                      "description": "Portable quiz-as-code document: exactly the PORTABLE authoring content under an opentrainQuizVersion envelope — never ids, timestamps, scope, revisions, assets, attempts, nor the server-owned settings.authoringDecision (the confirmed learning-plan decision is minted per form on create and preserved on update; it never travels in a document). Question/option ids are the author’s stable identifiers and survive export → edit → import.",
                      "required": [
                        "opentrainQuizVersion",
                        "title",
                        "settings",
                        "definition"
                      ],
                      "properties": {
                        "opentrainQuizVersion": {
                          "type": "number",
                          "enum": [
                            1
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 10000
                        },
                        "descriptionDoc": {
                          "description": "Optional rich description (TipTap JSON); the plain description is re-derived."
                        },
                        "settings": {
                          "type": "object",
                          "properties": {
                            "attemptPolicy": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "const": "UNLIMITED"
                                    }
                                  },
                                  "required": [
                                    "mode"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "const": "LIMITED"
                                    },
                                    "maxAttempts": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "mode",
                                    "maxAttempts"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "passRule": {
                              "anyOf": [
                                {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "mode": {
                                          "type": "string",
                                          "const": "PERCENTAGE"
                                        },
                                        "thresholdPercent": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100
                                        }
                                      },
                                      "required": [
                                        "mode",
                                        "thresholdPercent"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "mode": {
                                          "type": "string",
                                          "const": "ABSOLUTE"
                                        },
                                        "thresholdPoints": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 1000000
                                        }
                                      },
                                      "required": [
                                        "mode",
                                        "thresholdPoints"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "resultRelease": {
                              "type": "string",
                              "enum": [
                                "IMMEDIATE",
                                "MANUAL"
                              ]
                            }
                          },
                          "required": [
                            "attemptPolicy",
                            "passRule",
                            "resultRelease"
                          ],
                          "additionalProperties": false,
                          "description": "The portable Native Forms settings (attemptPolicy, passRule, resultRelease); closed — never authoringDecision."
                        },
                        "definition": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "schemaVersion": {
                                  "type": "number",
                                  "const": 1
                                },
                                "questions": {
                                  "maxItems": 500,
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "SHORT_TEXT"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "string",
                                                    "maxLength": 10000
                                                  },
                                                  "caseSensitive": {
                                                    "default": false,
                                                    "type": "boolean"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "PARAGRAPH"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "string",
                                                    "maxLength": 10000
                                                  },
                                                  "caseSensitive": {
                                                    "default": false,
                                                    "type": "boolean"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "MULTIPLE_CHOICE"
                                          },
                                          "options": {
                                            "minItems": 2,
                                            "maxItems": 200,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "label"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "optionId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  }
                                                },
                                                "required": [
                                                  "optionId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "options"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "CHECKBOXES"
                                          },
                                          "options": {
                                            "minItems": 1,
                                            "maxItems": 200,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "label"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "optionIds": {
                                                    "minItems": 1,
                                                    "maxItems": 200,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "optionIds"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "options"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "DROPDOWN"
                                          },
                                          "options": {
                                            "minItems": 2,
                                            "maxItems": 200,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "label"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "optionId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  }
                                                },
                                                "required": [
                                                  "optionId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "options"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "LINEAR_SCALE"
                                          },
                                          "min": {
                                            "type": "integer",
                                            "minimum": -100,
                                            "maximum": 100
                                          },
                                          "max": {
                                            "type": "integer",
                                            "minimum": -100,
                                            "maximum": 100
                                          },
                                          "minLabel": {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          "maxLabel": {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "number"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "tolerance": {
                                                "type": "number",
                                                "minimum": 0
                                              },
                                              "partialCredit": {
                                                "type": "string",
                                                "enum": [
                                                  "NONE",
                                                  "LINEAR"
                                                ]
                                              },
                                              "partialCreditRange": {
                                                "type": "number",
                                                "exclusiveMinimum": 0
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "min",
                                          "max"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "NUMBER"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "number"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "tolerance": {
                                                "type": "number",
                                                "minimum": 0
                                              },
                                              "partialCredit": {
                                                "type": "string",
                                                "enum": [
                                                  "NONE",
                                                  "LINEAR"
                                                ]
                                              },
                                              "partialCreditRange": {
                                                "type": "number",
                                                "exclusiveMinimum": 0
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "DATE"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "string",
                                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "SECTION"
                                          },
                                          "title": {
                                            "type": "string",
                                            "maxLength": 500
                                          },
                                          "description": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "descriptionDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "type",
                                          "title"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "TITLE"
                                          },
                                          "text": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "textDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "schemaVersion",
                                "questions"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "schemaVersion": {
                                  "type": "number",
                                  "const": 2
                                },
                                "questions": {
                                  "maxItems": 500,
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "SHORT_TEXT"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "string",
                                                    "maxLength": 10000
                                                  },
                                                  "caseSensitive": {
                                                    "default": false,
                                                    "type": "boolean"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "PARAGRAPH"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "string",
                                                    "maxLength": 10000
                                                  },
                                                  "caseSensitive": {
                                                    "default": false,
                                                    "type": "boolean"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "MULTIPLE_CHOICE"
                                          },
                                          "options": {
                                            "minItems": 2,
                                            "maxItems": 200,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "label"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "optionId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  }
                                                },
                                                "required": [
                                                  "optionId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "options"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "CHECKBOXES"
                                          },
                                          "options": {
                                            "minItems": 1,
                                            "maxItems": 200,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "label"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "optionIds": {
                                                    "minItems": 1,
                                                    "maxItems": 200,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "optionIds"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "options"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "DROPDOWN"
                                          },
                                          "options": {
                                            "minItems": 2,
                                            "maxItems": 200,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "label"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "optionId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  }
                                                },
                                                "required": [
                                                  "optionId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "options"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "LINEAR_SCALE"
                                          },
                                          "min": {
                                            "type": "integer",
                                            "minimum": -100,
                                            "maximum": 100
                                          },
                                          "max": {
                                            "type": "integer",
                                            "minimum": -100,
                                            "maximum": 100
                                          },
                                          "minLabel": {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          "maxLabel": {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "number"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "tolerance": {
                                                "type": "number",
                                                "minimum": 0
                                              },
                                              "partialCredit": {
                                                "type": "string",
                                                "enum": [
                                                  "NONE",
                                                  "LINEAR"
                                                ]
                                              },
                                              "partialCreditRange": {
                                                "type": "number",
                                                "exclusiveMinimum": 0
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type",
                                          "min",
                                          "max"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "NUMBER"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "number"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "tolerance": {
                                                "type": "number",
                                                "minimum": 0
                                              },
                                              "partialCredit": {
                                                "type": "string",
                                                "enum": [
                                                  "NONE",
                                                  "LINEAR"
                                                ]
                                              },
                                              "partialCreditRange": {
                                                "type": "number",
                                                "exclusiveMinimum": 0
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "prompt": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "promptDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          },
                                          "required": {
                                            "type": "boolean"
                                          },
                                          "manualGrading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              }
                                            },
                                            "required": [
                                              "points"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "practiceExplanation": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 4000
                                          },
                                          "sourceRefs": {
                                            "maxItems": 20,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "pageId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                },
                                                "nodeId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                }
                                              },
                                              "required": [
                                                "pageId",
                                                "nodeId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "rationale": {
                                            "type": "string",
                                            "maxLength": 2000
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "DATE"
                                          },
                                          "grading": {
                                            "type": "object",
                                            "properties": {
                                              "points": {
                                                "default": 1,
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10000
                                              },
                                              "answerKey": {
                                                "type": "object",
                                                "properties": {
                                                  "value": {
                                                    "type": "string",
                                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                                  }
                                                },
                                                "required": [
                                                  "value"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "answerKey"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "prompt",
                                          "required",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "SECTION"
                                          },
                                          "title": {
                                            "type": "string",
                                            "maxLength": 500
                                          },
                                          "description": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "descriptionDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "type",
                                          "title"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "type": {
                                            "type": "string",
                                            "const": "TITLE"
                                          },
                                          "text": {
                                            "type": "string",
                                            "maxLength": 10000
                                          },
                                          "textDoc": {
                                            "type": "object",
                                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                                            "additionalProperties": {}
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "grounding": {
                                  "type": "object",
                                  "properties": {
                                    "jobId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "instructionSetId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "treeChecksum": {
                                      "type": "string",
                                      "minLength": 8,
                                      "maxLength": 128
                                    },
                                    "pages": {
                                      "minItems": 1,
                                      "maxItems": 200,
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "pageId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "checksum": {
                                            "type": "string",
                                            "minLength": 8,
                                            "maxLength": 128
                                          }
                                        },
                                        "required": [
                                          "pageId",
                                          "checksum"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "capturedAt": {
                                      "type": "string",
                                      "format": "date-time"
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": [
                                        "released",
                                        "draft_preview"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "jobId",
                                    "instructionSetId",
                                    "treeChecksum",
                                    "pages",
                                    "capturedAt"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "schemaVersion",
                                "questions"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "The Native Forms definition (schemaVersion 1 | 2, the closed question union with stable ids, optional grounding on v2); rich documents (promptDoc / descriptionDoc / textDoc) are the only open nodes."
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or surface disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form or version not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/diff": {
      "get": {
        "operationId": "projectTodoQuizDiff",
        "tags": [
          "project-todos"
        ],
        "summary": "Structural diff of a quiz: draft vs published version, or two versions",
        "description": "Registry op `project_todos.quizzes.diff` (read scope, keyless). Default: the latest published version (`from`) vs the current draft (`to`); pass `fromVersionId` / `toVersionId` for any pair (`DRAFT` names the draft explicitly). Question identity is the author’s stable `id`: added / removed / changed (with the changed top-level fields) / unchanged / reordered, settings fields, title/description, schemaVersion and grounding changes, plus `affectedQuestionIds` and `identical`. A form with no published version and no explicit `fromVersionId` is 400.",
        "parameters": [
          {
            "name": "formId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fromVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "toVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quiz diff",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "formId",
                    "from",
                    "to",
                    "diff"
                  ],
                  "properties": {
                    "formId": {
                      "type": "string"
                    },
                    "from": {
                      "type": "object",
                      "required": [
                        "source",
                        "draftRevision",
                        "formVersionId",
                        "versionNumber",
                        "contentHash",
                        "recordedContentHash"
                      ],
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "VERSION"
                          ]
                        },
                        "draftRevision": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "formVersionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "versionNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "contentHash": {
                          "type": "string",
                          "description": "The PORTABLE content hash: hashNativeFormPublication over the document’s content (settings without the server-owned authoringDecision, the definition as stored). It identifies portable content across export → edit → import; it is NOT the hash a publication records (publishing prunes uncited grounding pins and refreshes the tree checksum, and a stored authoringDecision is part of the recorded settings) — see recordedContentHash."
                        },
                        "recordedContentHash": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The hash the publication recorded (VERSION sources); null for a draft."
                        }
                      },
                      "additionalProperties": false
                    },
                    "to": {
                      "type": "object",
                      "required": [
                        "source",
                        "draftRevision",
                        "formVersionId",
                        "versionNumber",
                        "contentHash",
                        "recordedContentHash"
                      ],
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "VERSION"
                          ]
                        },
                        "draftRevision": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "formVersionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "versionNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "contentHash": {
                          "type": "string",
                          "description": "The PORTABLE content hash: hashNativeFormPublication over the document’s content (settings without the server-owned authoringDecision, the definition as stored). It identifies portable content across export → edit → import; it is NOT the hash a publication records (publishing prunes uncited grounding pins and refreshes the tree checksum, and a stored authoringDecision is part of the recorded settings) — see recordedContentHash."
                        },
                        "recordedContentHash": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The hash the publication recorded (VERSION sources); null for a draft."
                        }
                      },
                      "additionalProperties": false
                    },
                    "diff": {
                      "type": "object",
                      "required": [
                        "title",
                        "description",
                        "descriptionDoc",
                        "settings",
                        "definition",
                        "questions",
                        "affectedQuestionIds",
                        "identical"
                      ],
                      "properties": {
                        "title": {
                          "type": "object",
                          "required": [
                            "changed",
                            "from",
                            "to"
                          ],
                          "properties": {
                            "changed": {
                              "type": "boolean"
                            },
                            "from": {
                              "type": "string"
                            },
                            "to": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        },
                        "description": {
                          "type": "object",
                          "required": [
                            "changed",
                            "from",
                            "to"
                          ],
                          "properties": {
                            "changed": {
                              "type": "boolean"
                            },
                            "from": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "to": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "descriptionDoc": {
                          "type": "object",
                          "required": [
                            "changed"
                          ],
                          "properties": {
                            "changed": {
                              "type": "boolean"
                            }
                          },
                          "additionalProperties": false
                        },
                        "settings": {
                          "type": "object",
                          "required": [
                            "changed",
                            "fields"
                          ],
                          "properties": {
                            "changed": {
                              "type": "boolean"
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "definition": {
                          "type": "object",
                          "required": [
                            "schemaVersion",
                            "grounding"
                          ],
                          "properties": {
                            "schemaVersion": {
                              "type": "object",
                              "required": [
                                "changed",
                                "from",
                                "to"
                              ],
                              "properties": {
                                "changed": {
                                  "type": "boolean"
                                },
                                "from": {
                                  "type": "number",
                                  "enum": [
                                    1,
                                    2
                                  ]
                                },
                                "to": {
                                  "type": "number",
                                  "enum": [
                                    1,
                                    2
                                  ]
                                }
                              },
                              "additionalProperties": false
                            },
                            "grounding": {
                              "type": "object",
                              "required": [
                                "changed"
                              ],
                              "properties": {
                                "changed": {
                                  "type": "boolean"
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "questions": {
                          "type": "object",
                          "required": [
                            "added",
                            "removed",
                            "changed",
                            "unchanged",
                            "reordered",
                            "orderFrom",
                            "orderTo"
                          ],
                          "properties": {
                            "added": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "removed": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "changed": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "id",
                                  "fields"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "fields": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "unchanged": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "reordered": {
                              "type": "boolean"
                            },
                            "orderFrom": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "orderTo": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "affectedQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "identical": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "No published version to compare against",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or surface disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form or version not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/templates": {
      "get": {
        "operationId": "projectTodoQuizTemplatesList",
        "tags": [
          "project-todos"
        ],
        "summary": "List organization quiz templates (reusable across jobs)",
        "description": "Registry op `project_todos.quizzes.templates.list` (read scope, keyless). Organization-scoped forms (`scopeJobId: null`) with their latest published version; archived templates only with `includeArchived=true`. Create one with `template_create_from_form`; create a NEW job form from one with `template_instantiate` (the template is never linked or mutated).",
        "parameters": [
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Organization templates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "organizationId",
                    "templates"
                  ],
                  "properties": {
                    "organizationId": {
                      "type": "string"
                    },
                    "templates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "title",
                          "description",
                          "scopeJobId",
                          "draftRevision",
                          "archivedAt",
                          "updatedAt",
                          "latestVersion"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "scopeJobId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "null = organization template."
                          },
                          "draftRevision": {
                            "type": "integer"
                          },
                          "archivedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "latestVersion": {
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "object",
                                "required": [
                                  "id",
                                  "versionNumber",
                                  "publishedAt",
                                  "contentHash"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "versionNumber": {
                                    "type": "integer"
                                  },
                                  "publishedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "contentHash": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or surface disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/grading-packet": {
      "get": {
        "operationId": "projectTodoQuizGradingPacket",
        "tags": [
          "project-todos"
        ],
        "summary": "Per-question grading packet for one attempt (employer-only)",
        "description": "Registry op `project_todos.quizzes.grading_packet.get` (read scope, keyless). For every answerable question: prompt, type, options, the worker’s response, the allowed point range, the current grade (+ revision), the employer-only `rubric` for manual questions, and the expected answer for AUTO-graded questions only — manual questions never carry a key. Plus the grading state, pass rule, release mode, current provenance, the full revision history with provenance (AGENT vs HUMAN, model, confidence, rubric version), and a `nextAction`. Attempt access is job-contained exactly like the attempt read.",
        "parameters": [
          {
            "name": "attemptId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Grading packet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "attemptId",
                    "jobId",
                    "formId",
                    "formTitle",
                    "formVersionId",
                    "versionNumber",
                    "attempt",
                    "grading",
                    "questions",
                    "history",
                    "nextAction"
                  ],
                  "properties": {
                    "attemptId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "formId": {
                      "type": "string"
                    },
                    "formTitle": {
                      "type": "string"
                    },
                    "formVersionId": {
                      "type": "string"
                    },
                    "versionNumber": {
                      "type": "integer"
                    },
                    "attempt": {
                      "type": "object",
                      "required": [
                        "attemptNumber",
                        "status",
                        "submittedAt",
                        "attemptKind",
                        "isLatestSubmitted",
                        "reviewable"
                      ],
                      "properties": {
                        "attemptNumber": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "IN_PROGRESS",
                            "SUBMITTED"
                          ]
                        },
                        "submittedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "attemptKind": {
                          "type": "string",
                          "enum": [
                            "FULL",
                            "REMEDIATION"
                          ]
                        },
                        "isLatestSubmitted": {
                          "type": "boolean"
                        },
                        "reviewable": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    "grading": {
                      "type": "object",
                      "required": [
                        "state",
                        "revisionNumber",
                        "pendingManualQuestionIds",
                        "passRule",
                        "releaseMode",
                        "released",
                        "earnedPoints",
                        "possiblePoints",
                        "currentProvenance"
                      ],
                      "properties": {
                        "state": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "IN_PROGRESS",
                            "PENDING_MANUAL",
                            "GRADED",
                            "UNSCORED",
                            null
                          ]
                        },
                        "revisionNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "pendingManualQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "passRule": {
                          "oneOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "object",
                              "required": [
                                "mode",
                                "thresholdPercent"
                              ],
                              "properties": {
                                "mode": {
                                  "type": "string",
                                  "enum": [
                                    "PERCENTAGE"
                                  ]
                                },
                                "thresholdPercent": {
                                  "type": "integer"
                                }
                              },
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "required": [
                                "mode",
                                "thresholdPoints"
                              ],
                              "properties": {
                                "mode": {
                                  "type": "string",
                                  "enum": [
                                    "ABSOLUTE"
                                  ]
                                },
                                "thresholdPoints": {
                                  "type": "integer"
                                }
                              },
                              "additionalProperties": false
                            }
                          ]
                        },
                        "releaseMode": {
                          "type": "string",
                          "enum": [
                            "IMMEDIATE",
                            "MANUAL"
                          ]
                        },
                        "released": {
                          "type": "boolean"
                        },
                        "earnedPoints": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "possiblePoints": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "currentProvenance": {
                          "oneOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "object",
                              "description": "Who graded and how. Recorded on the GRADE_REVISED audit event; read back on the employer-only attempt history and the grading packet; never shown to workers.",
                              "required": [
                                "grader"
                              ],
                              "properties": {
                                "grader": {
                                  "type": "string",
                                  "enum": [
                                    "AGENT",
                                    "HUMAN"
                                  ]
                                },
                                "model": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "provider": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "confidence": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                "rubricVersion": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "humanReviewed": {
                                  "type": "boolean"
                                }
                              },
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "questionId",
                          "type",
                          "prompt",
                          "required",
                          "scored",
                          "manual",
                          "rubric",
                          "options",
                          "response",
                          "allowedPoints",
                          "expectedAnswer",
                          "expectedDisplayValue",
                          "currentGrade"
                        ],
                        "properties": {
                          "questionId": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "prompt": {
                            "type": "string"
                          },
                          "required": {
                            "type": "boolean"
                          },
                          "scored": {
                            "type": "boolean"
                          },
                          "manual": {
                            "type": "boolean"
                          },
                          "rubric": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Employer-only grading guidance; only manual questions carry one."
                          },
                          "options": {
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "id",
                                    "label"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              }
                            ]
                          },
                          "response": {
                            "type": "object",
                            "required": [
                              "answered",
                              "value",
                              "displayValue"
                            ],
                            "properties": {
                              "answered": {
                                "type": "boolean"
                              },
                              "value": {
                                "description": "The raw submitted value.",
                                "oneOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "displayValue": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": false
                          },
                          "allowedPoints": {
                            "type": "object",
                            "required": [
                              "min",
                              "max"
                            ],
                            "properties": {
                              "min": {
                                "type": "integer"
                              },
                              "max": {
                                "type": "integer"
                              }
                            },
                            "additionalProperties": false
                          },
                          "expectedAnswer": {
                            "description": "Auto-graded questions only (the sanitized key in one of three closed shapes); null for manual questions.",
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "object",
                                "required": [
                                  "optionId"
                                ],
                                "properties": {
                                  "optionId": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "optionIds"
                                ],
                                "properties": {
                                  "optionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "value"
                                ],
                                "properties": {
                                  "value": {
                                    "type": [
                                      "number",
                                      "string"
                                    ]
                                  },
                                  "caseSensitive": {
                                    "type": "boolean",
                                    "enum": [
                                      true
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              }
                            ]
                          },
                          "expectedDisplayValue": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currentGrade": {
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "object",
                                "required": [
                                  "awardedPoints",
                                  "correct",
                                  "revisionNumber"
                                ],
                                "properties": {
                                  "awardedPoints": {
                                    "type": "integer"
                                  },
                                  "correct": {
                                    "type": [
                                      "boolean",
                                      "null"
                                    ]
                                  },
                                  "revisionNumber": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "revisionNumber",
                          "createdAt",
                          "origin",
                          "earnedPoints",
                          "possiblePoints",
                          "passed",
                          "note",
                          "provenance"
                        ],
                        "properties": {
                          "revisionNumber": {
                            "type": "integer"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "origin": {
                            "type": "string",
                            "enum": [
                              "EMPLOYER",
                              "SYSTEM_CARRY"
                            ]
                          },
                          "earnedPoints": {
                            "type": "integer"
                          },
                          "possiblePoints": {
                            "type": "integer"
                          },
                          "passed": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "provenance": {
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "object",
                                "description": "Who graded and how. Recorded on the GRADE_REVISED audit event; read back on the employer-only attempt history and the grading packet; never shown to workers.",
                                "required": [
                                  "grader"
                                ],
                                "properties": {
                                  "grader": {
                                    "type": "string",
                                    "enum": [
                                      "AGENT",
                                      "HUMAN"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "provider": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "confidence": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                  },
                                  "rubricVersion": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "humanReviewed": {
                                    "type": "boolean"
                                  }
                                },
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "nextAction": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or surface disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Attempt not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/export": {
      "get": {
        "operationId": "projectTodoQuizResultsExport",
        "tags": [
          "project-todos"
        ],
        "summary": "Export quiz results as JSON or JSONL with a redaction manifest",
        "description": "Registry op `project_todos.quizzes.results.export` (read scope, keyless). `format=json` (default) returns the canonical employer results read under an envelope with the redaction manifest; `format=jsonl` returns one self-describing record per line (`kind: manifest | attempt | summary | question`) inside the same JSON envelope (`jsonl`). Worker e-mails, answer keys, rubrics and coaching threads never travel; worker names/ids and grade notes do. The CSV lane (`/export-csv`) also omits worker e-mails and carries its own redaction declaration.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "jsonl"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Results export",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "format",
                        "jobId",
                        "formId",
                        "formVersionId",
                        "filename",
                        "generatedAt",
                        "rowCount",
                        "redaction",
                        "results"
                      ],
                      "properties": {
                        "format": {
                          "type": "string",
                          "enum": [
                            "json"
                          ]
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "formId": {
                          "type": "string"
                        },
                        "formVersionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "filename": {
                          "type": "string"
                        },
                        "generatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "rowCount": {
                          "type": "integer"
                        },
                        "redaction": {
                          "type": "object",
                          "description": "Every category the export touches: OMITTED (no field carries it), INCLUDED verbatim, or INCLUDED_EMAILS_REDACTED (e-mail addresses inside free text are replaced in place). The worker name never falls back to an e-mail (a worker without a name is \"Worker <id suffix>\").",
                          "required": [
                            "workerEmail",
                            "workerName",
                            "workerId",
                            "answerValues",
                            "reviewNotes",
                            "gradeNotes",
                            "gradeProvenance",
                            "auditMetadata",
                            "answerKeys",
                            "rubrics",
                            "promptRichContent",
                            "coachingThreads"
                          ],
                          "properties": {
                            "workerEmail": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "workerName": {
                              "type": "string",
                              "enum": [
                                "INCLUDED"
                              ]
                            },
                            "workerId": {
                              "type": "string",
                              "enum": [
                                "INCLUDED"
                              ]
                            },
                            "answerValues": {
                              "type": "string",
                              "enum": [
                                "INCLUDED_EMAILS_REDACTED"
                              ]
                            },
                            "reviewNotes": {
                              "type": "string",
                              "enum": [
                                "INCLUDED_EMAILS_REDACTED"
                              ]
                            },
                            "gradeNotes": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "gradeProvenance": {
                              "type": "string",
                              "enum": [
                                "INCLUDED"
                              ]
                            },
                            "auditMetadata": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "answerKeys": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "rubrics": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "promptRichContent": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "coachingThreads": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "results": {
                          "type": "object",
                          "description": "The redacted results DTO: form, full-attempt summary, per-question aggregates, attempts (allowlisted fields only) and the typed GRADE_REVISED facts.",
                          "required": [
                            "form",
                            "summary",
                            "questionAggregates",
                            "attempts",
                            "gradeRevisions"
                          ],
                          "properties": {
                            "form": {
                              "type": "object",
                              "required": [
                                "id",
                                "title",
                                "versionNumber"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "title": {
                                  "type": "string"
                                },
                                "versionNumber": {
                                  "type": [
                                    "integer",
                                    "null"
                                  ]
                                }
                              },
                              "additionalProperties": false
                            },
                            "summary": {
                              "type": "object",
                              "required": [
                                "submittedAttempts",
                                "uniqueRespondents",
                                "passedAttempts",
                                "failedAttempts",
                                "ungradedAttempts",
                                "needsGradingAttempts",
                                "averagePercent",
                                "pendingReviewAttempts",
                                "releasedAttempts",
                                "coachingRevisions"
                              ],
                              "properties": {
                                "submittedAttempts": {
                                  "type": "integer"
                                },
                                "uniqueRespondents": {
                                  "type": "integer"
                                },
                                "passedAttempts": {
                                  "type": "integer"
                                },
                                "failedAttempts": {
                                  "type": "integer"
                                },
                                "ungradedAttempts": {
                                  "type": "integer"
                                },
                                "needsGradingAttempts": {
                                  "type": "integer"
                                },
                                "averagePercent": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "pendingReviewAttempts": {
                                  "type": "integer"
                                },
                                "releasedAttempts": {
                                  "type": "integer"
                                },
                                "coachingRevisions": {
                                  "type": "integer"
                                }
                              },
                              "additionalProperties": false
                            },
                            "questionAggregates": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "questionId",
                                  "prompt",
                                  "type",
                                  "answeredCount",
                                  "skippedCount",
                                  "correctCount",
                                  "incorrectCount",
                                  "partialCount",
                                  "averageAwardedPoints",
                                  "numericAverage",
                                  "optionCounts"
                                ],
                                "properties": {
                                  "questionId": {
                                    "type": "string"
                                  },
                                  "prompt": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "answeredCount": {
                                    "type": "integer"
                                  },
                                  "skippedCount": {
                                    "type": "integer"
                                  },
                                  "correctCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "incorrectCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "partialCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "averageAwardedPoints": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "numericAverage": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "optionCounts": {
                                    "oneOf": [
                                      {
                                        "type": "null"
                                      },
                                      {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "required": [
                                            "optionId",
                                            "label",
                                            "count"
                                          ],
                                          "properties": {
                                            "optionId": {
                                              "type": "string"
                                            },
                                            "label": {
                                              "type": "string"
                                            },
                                            "count": {
                                              "type": "integer"
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      }
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "attempts": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "id",
                                  "bindingId",
                                  "assignmentId",
                                  "attemptNumber",
                                  "status",
                                  "startedAt",
                                  "submittedAt",
                                  "earnedPoints",
                                  "possiblePoints",
                                  "scorePercent",
                                  "passed",
                                  "gradeState",
                                  "pendingManualQuestionIds",
                                  "gradeRevisionNumber",
                                  "resultReleasedAt",
                                  "attemptKind",
                                  "cycleNumber",
                                  "displayAttemptNumber",
                                  "gradeOrigin",
                                  "respondent",
                                  "review",
                                  "answers"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "bindingId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "assignmentId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "attemptNumber": {
                                    "type": "integer"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "IN_PROGRESS",
                                      "SUBMITTED"
                                    ]
                                  },
                                  "startedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "earnedPoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "possiblePoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "scorePercent": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "passed": {
                                    "type": [
                                      "boolean",
                                      "null"
                                    ]
                                  },
                                  "gradeState": {
                                    "type": "string",
                                    "enum": [
                                      "IN_PROGRESS",
                                      "PENDING_MANUAL",
                                      "GRADED",
                                      "UNSCORED"
                                    ]
                                  },
                                  "pendingManualQuestionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "gradeRevisionNumber": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "resultReleasedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "attemptKind": {
                                    "type": "string",
                                    "enum": [
                                      "FULL",
                                      "REMEDIATION"
                                    ]
                                  },
                                  "cycleNumber": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "displayAttemptNumber": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "gradeOrigin": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "EMPLOYER",
                                      "SYSTEM_CARRY",
                                      null
                                    ]
                                  },
                                  "respondent": {
                                    "type": "object",
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Name on file, else \"Worker <id suffix>\"; never an e-mail."
                                      }
                                    },
                                    "additionalProperties": false
                                  },
                                  "review": {
                                    "type": "object",
                                    "required": [
                                      "state",
                                      "decidedAt",
                                      "note"
                                    ],
                                    "properties": {
                                      "state": {
                                        "type": "string",
                                        "enum": [
                                          "NOT_REQUIRED",
                                          "PENDING",
                                          "RETURNED",
                                          "APPROVED",
                                          "EXHAUSTED"
                                        ]
                                      },
                                      "decidedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "note": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "description": "E-mail addresses replaced in place."
                                      }
                                    },
                                    "additionalProperties": false
                                  },
                                  "answers": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "required": [
                                        "questionId",
                                        "prompt",
                                        "type",
                                        "value",
                                        "displayValue",
                                        "correct",
                                        "awardedPoints",
                                        "maxPoints"
                                      ],
                                      "properties": {
                                        "questionId": {
                                          "type": "string"
                                        },
                                        "prompt": {
                                          "type": "string"
                                        },
                                        "type": {
                                          "type": "string"
                                        },
                                        "value": {
                                          "description": "The submitted value with e-mail addresses replaced in place.",
                                          "oneOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "number"
                                            },
                                            {
                                              "type": "array",
                                              "items": {
                                                "type": "string"
                                              }
                                            }
                                          ]
                                        },
                                        "displayValue": {
                                          "type": "string"
                                        },
                                        "correct": {
                                          "type": [
                                            "boolean",
                                            "null"
                                          ]
                                        },
                                        "awardedPoints": {
                                          "type": [
                                            "integer",
                                            "null"
                                          ]
                                        },
                                        "maxPoints": {
                                          "type": [
                                            "integer",
                                            "null"
                                          ]
                                        }
                                      },
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "gradeRevisions": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "id",
                                  "createdAt",
                                  "attemptId",
                                  "actorUserId",
                                  "revisionNumber",
                                  "origin",
                                  "earnedPoints",
                                  "possiblePoints",
                                  "passed",
                                  "provenance"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "attemptId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "actorUserId": {
                                    "type": "string"
                                  },
                                  "revisionNumber": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "origin": {
                                    "type": "string",
                                    "enum": [
                                      "EMPLOYER",
                                      "SYSTEM_CARRY"
                                    ]
                                  },
                                  "earnedPoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "possiblePoints": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "passed": {
                                    "type": [
                                      "boolean",
                                      "null"
                                    ]
                                  },
                                  "provenance": {
                                    "oneOf": [
                                      {
                                        "type": "null"
                                      },
                                      {
                                        "type": "object",
                                        "description": "Who graded and how. Recorded on the GRADE_REVISED audit event; read back on the employer-only attempt history and the grading packet; never shown to workers.",
                                        "required": [
                                          "grader"
                                        ],
                                        "properties": {
                                          "grader": {
                                            "type": "string",
                                            "enum": [
                                              "AGENT",
                                              "HUMAN"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "provider": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "confidence": {
                                            "type": "number",
                                            "minimum": 0,
                                            "maximum": 1
                                          },
                                          "rubricVersion": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "humanReviewed": {
                                            "type": "boolean"
                                          }
                                        },
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              }
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "format",
                        "jobId",
                        "formId",
                        "formVersionId",
                        "filename",
                        "generatedAt",
                        "rowCount",
                        "redaction",
                        "lineCount",
                        "jsonl"
                      ],
                      "properties": {
                        "format": {
                          "type": "string",
                          "enum": [
                            "jsonl"
                          ]
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "formId": {
                          "type": "string"
                        },
                        "formVersionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "filename": {
                          "type": "string"
                        },
                        "generatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "rowCount": {
                          "type": "integer"
                        },
                        "redaction": {
                          "type": "object",
                          "description": "Every category the export touches: OMITTED (no field carries it), INCLUDED verbatim, or INCLUDED_EMAILS_REDACTED (e-mail addresses inside free text are replaced in place). The worker name never falls back to an e-mail (a worker without a name is \"Worker <id suffix>\").",
                          "required": [
                            "workerEmail",
                            "workerName",
                            "workerId",
                            "answerValues",
                            "reviewNotes",
                            "gradeNotes",
                            "gradeProvenance",
                            "auditMetadata",
                            "answerKeys",
                            "rubrics",
                            "promptRichContent",
                            "coachingThreads"
                          ],
                          "properties": {
                            "workerEmail": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "workerName": {
                              "type": "string",
                              "enum": [
                                "INCLUDED"
                              ]
                            },
                            "workerId": {
                              "type": "string",
                              "enum": [
                                "INCLUDED"
                              ]
                            },
                            "answerValues": {
                              "type": "string",
                              "enum": [
                                "INCLUDED_EMAILS_REDACTED"
                              ]
                            },
                            "reviewNotes": {
                              "type": "string",
                              "enum": [
                                "INCLUDED_EMAILS_REDACTED"
                              ]
                            },
                            "gradeNotes": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "gradeProvenance": {
                              "type": "string",
                              "enum": [
                                "INCLUDED"
                              ]
                            },
                            "auditMetadata": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "answerKeys": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "rubrics": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "promptRichContent": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            },
                            "coachingThreads": {
                              "type": "string",
                              "enum": [
                                "OMITTED"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "lineCount": {
                          "type": "integer"
                        },
                        "jsonl": {
                          "type": "string",
                          "description": "One JSON record per line (kind: manifest | attempt | summary | question | grade-revision — the same redacted fields as the JSON results), trailing newline."
                        }
                      },
                      "additionalProperties": false
                    }
                  ],
                  "discriminator": {
                    "propertyName": "format"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign job/form",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form or job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/authoring/capabilities": {
      "get": {
        "operationId": "projectTodoQuizAuthoringCapabilities",
        "tags": [
          "project-todos"
        ],
        "summary": "Quiz authoring capabilities (static facts; ungated)",
        "description": "Registry op `project_todos.quizzes.capabilities`. Requires ONLY a non-DEVICE token with `project_todos:read` — no surface flag, no claimed account, no job — so an agent can learn the authoring contract before the surface is enabled: the quiz-as-code document version, schema versions, question types (derived from the validator), limits, grading modes and answer-key shapes, partial-credit modes, the manual `rubric`, the grade-provenance vocabulary, settings/To-Do enums, export formats, the canonical workflows (including `workflows.events`, the quiz to-do lifecycle event kinds for webhooks and GET /updates, and `workflows.subscribe`) and what is never exposed. Static facts only; no tenant data.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authoring capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "quizCodeDocumentVersion",
                    "schemaVersions",
                    "questionTypes",
                    "limits",
                    "grading",
                    "settings",
                    "todo",
                    "exports",
                    "workflows",
                    "neverExposed"
                  ],
                  "properties": {
                    "quizCodeDocumentVersion": {
                      "type": "number",
                      "enum": [
                        1
                      ]
                    },
                    "schemaVersions": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    },
                    "questionTypes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "limits": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "object",
                            "required": [
                              "min",
                              "max"
                            ],
                            "properties": {
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "grading": {
                      "type": "object",
                      "required": [
                        "modes",
                        "autoAnswerKeys",
                        "partialCreditModes",
                        "manual",
                        "provenance"
                      ],
                      "properties": {
                        "modes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "autoAnswerKeys": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "partialCreditModes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "manual": {
                          "type": "object",
                          "required": [
                            "field",
                            "rubricSchemaVersions",
                            "workerVisible"
                          ],
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "rubricSchemaVersions": {
                              "type": "array",
                              "items": {
                                "type": "integer"
                              }
                            },
                            "workerVisible": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        },
                        "provenance": {
                          "type": "object",
                          "required": [
                            "graders",
                            "fields",
                            "storedOn"
                          ],
                          "properties": {
                            "graders": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "storedOn": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "settings": {
                      "type": "object",
                      "required": [
                        "attemptPolicy",
                        "passRule",
                        "resultRelease"
                      ],
                      "properties": {
                        "attemptPolicy": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "passRule": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "resultRelease": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "todo": {
                      "type": "object",
                      "required": [
                        "completionPolicies",
                        "audiences",
                        "priorities",
                        "blockingModes",
                        "onPassRequires"
                      ],
                      "properties": {
                        "completionPolicies": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "audiences": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "priorities": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "blockingModes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "onPassRequires": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "exports": {
                      "type": "object",
                      "required": [
                        "results",
                        "quizCode"
                      ],
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "quizCode": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "workflows": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "neverExposed": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or device token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/results": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "List per-worker attempts and grading state for one job-local quiz",
        "description": "Requires `project_todos:read`, the default-off project-todos agent surface, and employer access to the explicit job/form. Worker personal emails and expected answers are omitted from this aggregate.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quiz attempts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "form",
                    "summary",
                    "questionAggregates",
                    "attempts",
                    "auditEvents",
                    "jobId"
                  ],
                  "properties": {
                    "form": {
                      "type": "object",
                      "required": [
                        "id",
                        "title",
                        "versionNumber"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "title": {
                          "type": "string"
                        },
                        "versionNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "summary": {
                      "type": "object",
                      "required": [
                        "submittedAttempts",
                        "uniqueRespondents",
                        "passedAttempts",
                        "failedAttempts",
                        "ungradedAttempts",
                        "needsGradingAttempts",
                        "averagePercent",
                        "pendingReviewAttempts",
                        "releasedAttempts",
                        "coachingRevisions"
                      ],
                      "properties": {
                        "submittedAttempts": {
                          "type": "integer"
                        },
                        "uniqueRespondents": {
                          "type": "integer"
                        },
                        "passedAttempts": {
                          "type": "integer"
                        },
                        "failedAttempts": {
                          "type": "integer"
                        },
                        "ungradedAttempts": {
                          "type": "integer"
                        },
                        "needsGradingAttempts": {
                          "type": "integer"
                        },
                        "averagePercent": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "pendingReviewAttempts": {
                          "type": "integer"
                        },
                        "releasedAttempts": {
                          "type": "integer"
                        },
                        "coachingRevisions": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": false
                    },
                    "questionAggregates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "questionId",
                          "prompt",
                          "type",
                          "answeredCount",
                          "skippedCount",
                          "correctCount",
                          "incorrectCount",
                          "partialCount",
                          "averageAwardedPoints",
                          "numericAverage",
                          "optionCounts"
                        ],
                        "properties": {
                          "questionId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "prompt": {
                            "type": "string"
                          },
                          "promptDoc": {
                            "type": "object",
                            "description": "TipTap rich document (extensible; validated in depth by the server).",
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "SHORT_TEXT",
                              "PARAGRAPH",
                              "MULTIPLE_CHOICE",
                              "CHECKBOXES",
                              "DROPDOWN",
                              "LINEAR_SCALE",
                              "NUMBER",
                              "DATE"
                            ]
                          },
                          "answeredCount": {
                            "type": "integer"
                          },
                          "skippedCount": {
                            "type": "integer"
                          },
                          "correctCount": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "incorrectCount": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "partialCount": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "averageAwardedPoints": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "numericAverage": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "optionCounts": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "optionId",
                                    "label",
                                    "count"
                                  ],
                                  "properties": {
                                    "optionId": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "label": {
                                      "type": "string"
                                    },
                                    "count": {
                                      "type": "integer"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "bindingId",
                          "assignmentId",
                          "attemptNumber",
                          "status",
                          "startedAt",
                          "submittedAt",
                          "earnedPoints",
                          "possiblePoints",
                          "scorePercent",
                          "passed",
                          "gradeState",
                          "pendingManualQuestionIds",
                          "gradeRevisionNumber",
                          "resultReleasedAt",
                          "attemptKind",
                          "cycleNumber",
                          "displayAttemptNumber",
                          "gradeOrigin",
                          "respondent",
                          "review",
                          "answers"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "bindingId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "assignmentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "attemptNumber": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "IN_PROGRESS",
                              "SUBMITTED"
                            ]
                          },
                          "startedAt": {
                            "type": "string"
                          },
                          "submittedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "earnedPoints": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "possiblePoints": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "scorePercent": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "passed": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "gradeState": {
                            "type": "string",
                            "enum": [
                              "IN_PROGRESS",
                              "PENDING_MANUAL",
                              "GRADED",
                              "UNSCORED"
                            ]
                          },
                          "pendingManualQuestionIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "gradeRevisionNumber": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "resultReleasedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "attemptKind": {
                            "type": "string",
                            "enum": [
                              "FULL",
                              "REMEDIATION"
                            ]
                          },
                          "cycleNumber": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "displayAttemptNumber": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "gradeOrigin": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "EMPLOYER",
                                  "SYSTEM_CARRY"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "respondent": {
                            "type": "object",
                            "required": [
                              "id",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": false
                          },
                          "review": {
                            "type": "object",
                            "required": [
                              "state",
                              "decidedAt",
                              "note"
                            ],
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "NOT_REQUIRED",
                                  "PENDING",
                                  "RETURNED",
                                  "APPROVED",
                                  "EXHAUSTED"
                                ]
                              },
                              "decidedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "note": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": false
                          },
                          "answers": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "required": [
                                "questionId",
                                "value",
                                "correct",
                                "awardedPoints",
                                "maxPoints",
                                "prompt",
                                "type",
                                "displayValue"
                              ],
                              "properties": {
                                "questionId": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "value": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    }
                                  ]
                                },
                                "correct": {
                                  "type": [
                                    "boolean",
                                    "null"
                                  ]
                                },
                                "awardedPoints": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "maxPoints": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "prompt": {
                                  "type": "string"
                                },
                                "promptDoc": {
                                  "type": "object",
                                  "description": "TipTap rich document (extensible; validated in depth by the server).",
                                  "additionalProperties": {}
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "SHORT_TEXT",
                                    "PARAGRAPH",
                                    "MULTIPLE_CHOICE",
                                    "CHECKBOXES",
                                    "DROPDOWN",
                                    "LINEAR_SCALE",
                                    "NUMBER",
                                    "DATE"
                                  ]
                                },
                                "displayValue": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "auditEvents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "createdAt",
                          "attemptId",
                          "actorUserId",
                          "eventType",
                          "metadata"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "attemptId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "actorUserId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "eventType": {
                            "type": "string"
                          },
                          "metadata": {
                            "description": "The audit event metadata: any JSON value, shaped by the event type; null when the event carries none (open by design)."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "jobId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign job/form",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form or job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/attempts/{attemptId}": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "Read one employer-authorized quiz attempt and expected-answer projection",
        "description": "Requires `project_todos:read` and employer access to the attempt’s exact assignment job. Returns submitted answers, grading rows/history, release state, and the sanitized employer-only `expectedAnswers` projection for auto-graded questions. Manual questions return null expected answers. This projection is never exposed on worker, roster, list, or CSV surfaces.",
        "parameters": [
          {
            "name": "attemptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quiz attempt detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "formId",
                    "formTitle",
                    "attempt",
                    "assignment",
                    "isLatestSubmitted",
                    "reviewable",
                    "reviewCycles",
                    "sourceAttempt",
                    "grading",
                    "jobId",
                    "expectedAnswers"
                  ],
                  "properties": {
                    "formId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "formTitle": {
                      "type": "string"
                    },
                    "attempt": {
                      "type": "object",
                      "required": [
                        "id",
                        "bindingId",
                        "assignmentId",
                        "attemptNumber",
                        "status",
                        "startedAt",
                        "submittedAt",
                        "earnedPoints",
                        "possiblePoints",
                        "scorePercent",
                        "passed",
                        "gradeState",
                        "pendingManualQuestionIds",
                        "gradeRevisionNumber",
                        "resultReleasedAt",
                        "attemptKind",
                        "cycleNumber",
                        "displayAttemptNumber",
                        "gradeOrigin",
                        "respondent",
                        "review",
                        "answers"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "bindingId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attemptNumber": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "IN_PROGRESS",
                            "SUBMITTED"
                          ]
                        },
                        "startedAt": {
                          "type": "string"
                        },
                        "submittedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "earnedPoints": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "possiblePoints": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "scorePercent": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "passed": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "gradeState": {
                          "type": "string",
                          "enum": [
                            "IN_PROGRESS",
                            "PENDING_MANUAL",
                            "GRADED",
                            "UNSCORED"
                          ]
                        },
                        "pendingManualQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "gradeRevisionNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "resultReleasedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attemptKind": {
                          "type": "string",
                          "enum": [
                            "FULL",
                            "REMEDIATION"
                          ]
                        },
                        "cycleNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "displayAttemptNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "gradeOrigin": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "EMPLOYER",
                                "SYSTEM_CARRY"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "respondent": {
                          "type": "object",
                          "required": [
                            "id",
                            "name"
                          ],
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        },
                        "review": {
                          "type": "object",
                          "required": [
                            "state",
                            "decidedAt",
                            "note"
                          ],
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "NOT_REQUIRED",
                                "PENDING",
                                "RETURNED",
                                "APPROVED",
                                "EXHAUSTED"
                              ]
                            },
                            "decidedAt": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "answers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "questionId",
                              "value",
                              "correct",
                              "awardedPoints",
                              "maxPoints",
                              "prompt",
                              "type",
                              "displayValue"
                            ],
                            "properties": {
                              "questionId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "value": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                ]
                              },
                              "correct": {
                                "type": [
                                  "boolean",
                                  "null"
                                ]
                              },
                              "awardedPoints": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "maxPoints": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "prompt": {
                                "type": "string"
                              },
                              "promptDoc": {
                                "type": "object",
                                "description": "TipTap rich document (extensible; validated in depth by the server).",
                                "additionalProperties": {}
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "SHORT_TEXT",
                                  "PARAGRAPH",
                                  "MULTIPLE_CHOICE",
                                  "CHECKBOXES",
                                  "DROPDOWN",
                                  "LINEAR_SCALE",
                                  "NUMBER",
                                  "DATE"
                                ]
                              },
                              "displayValue": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "assignment": {
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "id",
                            "status",
                            "submittedAt",
                            "dueAt",
                            "jobId"
                          ],
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "status": {
                              "type": "string"
                            },
                            "submittedAt": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "dueAt": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "jobId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "isLatestSubmitted": {
                      "type": "boolean"
                    },
                    "reviewable": {
                      "type": "boolean"
                    },
                    "reviewCycles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "cycleNumber",
                          "status",
                          "requestedQuestionIds",
                          "reason",
                          "sentAt",
                          "closedReason",
                          "sourceAttemptId",
                          "remediationAttemptId"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "cycleNumber": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "OPEN",
                              "RESUBMITTED",
                              "CLOSED"
                            ]
                          },
                          "requestedQuestionIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sentAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "closedReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sourceAttemptId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "remediationAttemptId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "sourceAttempt": {
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "id",
                            "submittedAt",
                            "answers"
                          ],
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "submittedAt": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "answers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "questionId",
                                  "displayValue"
                                ],
                                "properties": {
                                  "questionId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "displayValue": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": false
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "grading": {
                      "type": "object",
                      "required": [
                        "state",
                        "pendingManualQuestionIds",
                        "revisionNumber",
                        "history",
                        "rows"
                      ],
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "IN_PROGRESS",
                            "PENDING_MANUAL",
                            "GRADED",
                            "UNSCORED"
                          ]
                        },
                        "pendingManualQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "revisionNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "history": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "revisionNumber",
                              "createdAt",
                              "gradedBy",
                              "earnedPoints",
                              "possiblePoints",
                              "passed",
                              "note",
                              "origin",
                              "cycleNumber",
                              "provenance"
                            ],
                            "properties": {
                              "revisionNumber": {
                                "type": "integer"
                              },
                              "createdAt": {
                                "type": "string"
                              },
                              "gradedBy": {
                                "type": "object",
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": false
                              },
                              "earnedPoints": {
                                "type": "number"
                              },
                              "possiblePoints": {
                                "type": "number"
                              },
                              "passed": {
                                "type": [
                                  "boolean",
                                  "null"
                                ]
                              },
                              "note": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "origin": {
                                "type": "string",
                                "enum": [
                                  "EMPLOYER",
                                  "SYSTEM_CARRY"
                                ]
                              },
                              "cycleNumber": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "provenance": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "required": [
                                      "grader"
                                    ],
                                    "properties": {
                                      "grader": {
                                        "type": "string",
                                        "enum": [
                                          "AGENT",
                                          "HUMAN"
                                        ]
                                      },
                                      "model": {
                                        "type": "string"
                                      },
                                      "provider": {
                                        "type": "string"
                                      },
                                      "confidence": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                      },
                                      "rubricVersion": {
                                        "type": "string"
                                      },
                                      "humanReviewed": {
                                        "type": "boolean"
                                      }
                                    },
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "questionId",
                              "prompt",
                              "manual",
                              "correct",
                              "awardedPoints",
                              "maxPoints",
                              "displayValue",
                              "answered"
                            ],
                            "properties": {
                              "questionId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "prompt": {
                                "type": "string"
                              },
                              "manual": {
                                "type": "boolean"
                              },
                              "correct": {
                                "type": [
                                  "boolean",
                                  "null"
                                ]
                              },
                              "awardedPoints": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "maxPoints": {
                                "type": "number"
                              },
                              "displayValue": {
                                "type": "string"
                              },
                              "answered": {
                                "type": "boolean"
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "jobId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "expectedAnswers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "questionId",
                          "expectedAnswer",
                          "expectedDisplayValue",
                          "manuallyGraded"
                        ],
                        "properties": {
                          "questionId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "expectedAnswer": {
                            "anyOf": [
                              {
                                "type": "object",
                                "required": [
                                  "optionId"
                                ],
                                "properties": {
                                  "optionId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "optionIds"
                                ],
                                "properties": {
                                  "optionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "value"
                                ],
                                "properties": {
                                  "value": {
                                    "type": [
                                      "string",
                                      "number"
                                    ]
                                  },
                                  "caseSensitive": {
                                    "type": "boolean",
                                    "const": true
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "expectedDisplayValue": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "manuallyGraded": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign attempt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Attempt not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/roster": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "Read per-assignee quiz status for one job",
        "description": "Requires `project_todos:read` and employer access to the explicit job/form. Returns stable worker and assignment ids plus status; personal emails and expected answers are omitted.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quiz roster",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jobId",
                    "formId",
                    "rows",
                    "summary"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "formId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "assignmentId",
                          "assignmentStatus",
                          "itemTitle",
                          "contractId",
                          "worker",
                          "formVersionId",
                          "formVersionNumber",
                          "state",
                          "attemptCount",
                          "coachingRevisionCount",
                          "returnCount",
                          "latestAttempt"
                        ],
                        "properties": {
                          "assignmentId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "assignmentStatus": {
                            "type": "string"
                          },
                          "itemTitle": {
                            "type": "string"
                          },
                          "contractId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "worker": {
                            "type": "object",
                            "required": [
                              "id",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": false
                          },
                          "formVersionId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "formVersionNumber": {
                            "type": "integer"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "NOT_STARTED",
                              "IN_PROGRESS",
                              "NEEDS_GRADING",
                              "PASSED",
                              "FAILED_RETRY_AVAILABLE",
                              "EXHAUSTED",
                              "SUBMITTED",
                              "RETURNED",
                              "COMPLETED",
                              "CLOSED"
                            ]
                          },
                          "attemptCount": {
                            "type": "integer"
                          },
                          "coachingRevisionCount": {
                            "type": "integer"
                          },
                          "returnCount": {
                            "type": "integer"
                          },
                          "latestAttempt": {
                            "anyOf": [
                              {
                                "type": "object",
                                "required": [
                                  "id",
                                  "attemptNumber",
                                  "status",
                                  "submittedAt",
                                  "earnedPoints",
                                  "possiblePoints",
                                  "scorePercent",
                                  "passed",
                                  "gradeState",
                                  "gradeRevisionNumber",
                                  "released",
                                  "releasable"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "attemptNumber": {
                                    "type": "integer"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "IN_PROGRESS",
                                      "SUBMITTED"
                                    ]
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "earnedPoints": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "possiblePoints": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "scorePercent": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "passed": {
                                    "type": [
                                      "boolean",
                                      "null"
                                    ]
                                  },
                                  "gradeState": {
                                    "type": "string",
                                    "enum": [
                                      "IN_PROGRESS",
                                      "PENDING_MANUAL",
                                      "GRADED",
                                      "UNSCORED"
                                    ]
                                  },
                                  "gradeRevisionNumber": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "released": {
                                    "type": "boolean"
                                  },
                                  "releasable": {
                                    "type": "boolean"
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "summary": {
                      "type": "object",
                      "required": [
                        "assignees",
                        "needsGrading",
                        "releasable"
                      ],
                      "properties": {
                        "assignees": {
                          "type": "integer"
                        },
                        "needsGrading": {
                          "type": "integer"
                        },
                        "releasable": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or device token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form or job not found: another organization's job or form, a job the caller cannot access and a missing id are one indistinguishable 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/export-csv": {
      "get": {
        "tags": [
          "project-todos"
        ],
        "summary": "Export canonical quiz results without personal emails",
        "description": "Requires `project_todos:read` and employer access to the explicit job/form. Returns the canonical spreadsheet-formula-neutralized results CSV; worker personal emails and expected answers are omitted.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quiz results CSV",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jobId",
                    "formId",
                    "filename",
                    "csv",
                    "rowCount",
                    "redactions"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string",
                      "description": "The job the export was read under."
                    },
                    "formId": {
                      "type": "string",
                      "description": "The exported form."
                    },
                    "filename": {
                      "type": "string"
                    },
                    "csv": {
                      "type": "string"
                    },
                    "rowCount": {
                      "type": "integer"
                    },
                    "redactions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign job/form",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Form or job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/grounding": {
      "get": {
        "operationId": "projectTodoQuizGroundingSnapshot",
        "tags": [
          "project-todos"
        ],
        "summary": "Instructions grounding snapshot for quiz authoring (read-only)",
        "description": "DEV-2678. The job’s effective canonical Instructions pages (job-owned or folder-inherited) with their content checksums, the effective instruction-set id and the page-tree checksum — exactly what an agent pins into `definition.grounding` after reading the pages through the Instructions operations (`GET /instructions/jobs/{jobId}` + page reads, which carry the stable block ids `attrs.id` that `sourceRefs` cite). By default this reads the RELEASED Instructions, the version workers see; the response then has no `source` key (absence means released, so the released shape is unchanged): folder release first, then job release; Google Doc pages are read live, as workers read them. `draftPreview=true` reads the unreleased draft instead and returns `source: draft_preview` with a `previewLabel`; such a quiz validates with a GROUNDING_DRAFT_PREVIEW finding and publish refuses it with 409 `details.reason: GROUNDING_DRAFT_PREVIEW` until the Instructions are released and the grounding is re-captured without draftPreview (a draft pin is never promoted automatically). A job with no released Instructions is a 409 `details.reason: INSTRUCTIONS_NOT_RELEASED` (never an empty snapshot). Page titles and checksums travel, so this requires `instructions:read` in addition to `project_todos:read`, the default-off project-todos agent surface, a claimed employer account and access to the job. Never creates an instruction set; resolving the released view may record the same idempotent effective-view row a worker read records. Page reads return the DRAFT by default: write every grounded question from the released text (`GET /instructions/jobs/{jobId}/pages/{pageId}?released=true`, whose checksum equals the pinned one). With `X-OpenTrain-Features: quiz-grounding-draft-differs-v1`, each page of a released snapshot also carries `draftDiffers`: true when the unreleased draft differs from the released text or could not be read in time (10 s per page, 30 s for the whole comparison); always false for Google Doc pages, which are read live. An unreadable draft never fails a released snapshot (`form_validate` reports it as a DRAFT_UNREADABLE warning); the retryable 503 means a page of the version being snapshotted (the released one, or the draft under draftPreview) could not be read.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-OpenTrain-Features",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opt into the draft-differs fields with the token `quiz-grounding-draft-differs-v1`: `pages[].draftDiffers` on a released grounding snapshot, and the DRAFT_DIFFERS / DRAFT_UNREADABLE grounding WARNINGs on form_validate. Omit for the legacy response shape (installed strict clients refuse the new keys). quiz_rollout_plan always reports the same facts as `warnings[]` strings."
          },
          {
            "name": "draftPreview",
            "in": "query",
            "required": false,
            "description": "true = ground on the unreleased draft as a labeled preview that cannot be published. Default false (released Instructions).",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "default": "false"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Grounding snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jobId",
                    "instructionSetId",
                    "treeChecksum",
                    "capturedAt",
                    "pages",
                    "inheritedFromFolder",
                    "grounding"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "released",
                        "draft_preview"
                      ],
                      "description": "Which Instructions version was read. `released` (the default) is the version workers see and the only one a quiz publishes from. `draft_preview` (requested with draftPreview=true) reads unreleased edits, is labeled on every surface, and publish refuses it with 409 GROUNDING_DRAFT_PREVIEW until the Instructions are released and the grounding is re-captured. Responses carry it only on a draft preview; an absent source is `released`."
                    },
                    "previewLabel": {
                      "type": "string",
                      "description": "Present only for a `draft_preview` grounding: the preview label to show the user. Absent for released Instructions."
                    },
                    "instructionSetId": {
                      "type": "string"
                    },
                    "treeChecksum": {
                      "type": "string"
                    },
                    "capturedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "pageId",
                          "title",
                          "parentPageId",
                          "checksum",
                          "stableNodeIdCount"
                        ],
                        "properties": {
                          "pageId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "parentPageId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "checksum": {
                            "type": "string"
                          },
                          "stableNodeIdCount": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "draftDiffers": {
                            "type": "boolean",
                            "description": "Released captures only, and only when the X-OpenTrain-Features header names quiz-grounding-draft-differs-v1: true when the job’s unreleased draft of this page differs from the released content, no longer has the page, or could not be read to compare (the snapshot never fails on an unreadable draft). Write questions on such a page from the released text (Instructions page read with released=true), never the draft. Always false for GOOGLE_DOC pages (read live: released = draft). Absent otherwise."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "inheritedFromFolder": {
                      "type": "boolean"
                    },
                    "grounding": {
                      "type": "object",
                      "description": "The block to copy verbatim into `definition.grounding` (schemaVersion 2). Each answerable question may then carry `sourceRefs: [{ pageId, nodeId }]` (≤ 20; pageId must be pinned here; nodeId is a stable TipTap block `attrs.id` on that page) and an optional `rationale` (≤ 2000 chars). Workers never see either.",
                      "required": [
                        "jobId",
                        "instructionSetId",
                        "treeChecksum",
                        "pages",
                        "capturedAt"
                      ],
                      "properties": {
                        "jobId": {
                          "type": "string"
                        },
                        "instructionSetId": {
                          "type": "string"
                        },
                        "treeChecksum": {
                          "type": "string"
                        },
                        "pages": {
                          "type": "array",
                          "maxItems": 200,
                          "items": {
                            "type": "object",
                            "required": [
                              "pageId",
                              "checksum"
                            ],
                            "properties": {
                              "pageId": {
                                "type": "string"
                              },
                              "checksum": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "capturedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "released",
                            "draft_preview"
                          ],
                          "description": "Which Instructions version was read. `released` (the default) is the version workers see and the only one a quiz publishes from. `draft_preview` (requested with draftPreview=true) reads unreleased edits, is labeled on every surface, and publish refuses it with 409 GROUNDING_DRAFT_PREVIEW until the Instructions are released and the grounding is re-captured. Responses carry it only on a draft preview; an absent source is `released`."
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Draft preview of a job without Instructions, or more pages than grounding supports",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or surface disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found: another organization's job, a job the caller cannot access and a missing job are one indistinguishable 404",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "INSTRUCTIONS_NOT_RELEASED: the job has no released Instructions (release them, or pass draftPreview=true for a labeled preview)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "An Instructions page is temporarily unreadable (retry)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/manage": {
      "post": {
        "tags": [
          "project-todos"
        ],
        "parameters": [
          {
            "name": "X-OpenTrain-Features",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opt into the draft-differs fields with the token `quiz-grounding-draft-differs-v1`: `pages[].draftDiffers` on a released grounding snapshot, and the DRAFT_DIFFERS / DRAFT_UNREADABLE grounding WARNINGs on form_validate. Omit for the legacy response shape (installed strict clients refuse the new keys). quiz_rollout_plan always reports the same facts as `warnings[]` strings."
          }
        ],
        "summary": "Author, validate, publish, assign, grade, release, and require retakes for job-local quizzes",
        "description": "One quiz mutation per call via a discriminated `action` union: `form_create`, `form_update_draft` (receipt-idempotent; `expectedRevision` optimistic lock), `form_patch_draft` (closed branch; receipt-idempotent; `expectedRevision` optimistic lock: an ordered `operations` list — `add` / `update` / `remove` / `move` (reorder) — keyed by stable question ids, applied to the current draft through the same draft service, so an agent changes one question without re-sending the quiz; an unknown id or duplicate add is 400 and nothing is written; returns the new revision and the structural `diff` of the patch), `form_validate` (NO-WRITE, read-scoped, keyless — `project_todos.quizzes.validate`: every schema, publication-rule and Instructions-grounding finding at once for the stored draft `formId` OR a candidate `jobId` + `definition` + `settings`; `publishable: false` with `affectedQuestionIds` tells the agent exactly what to fix before publishing; with `X-OpenTrain-Features: quiz-grounding-draft-differs-v1` a released grounding also gets a non-blocking DRAFT_DIFFERS WARNING per cited page whose unreleased draft differs from the released text, DRAFT_UNREADABLE when that draft could not be read, so re-check those questions against the released page read), `form_publish` (immutable version; when the draft carries `definition.grounding`, the live Instructions are re-read first and drift is refused with 409 `details.reason: SOURCE_CHANGED` naming the affected questions — re-read the cited pages, update or re-ground those questions via `form_update_draft`, publish again; the published version records the grounding it was validated against; the fence reads the RELEASED Instructions, and a grounding captured with draftPreview is refused with 409 `details.reason: GROUNDING_DRAFT_PREVIEW` — release the Instructions, re-capture the grounding, then publish; because the fence reads the job’s Instructions, publishing a grounded draft also requires `instructions:read` (403 otherwise), while an ungrounded publish stays `project_todos:write` only), `form_duplicate`, `form_archive`, `form_restore` (idempotent un-archive; published versions untouched), `quiz_todo_preflight` (no-write preview of quiz_todo_create — masked recipients, exact current/future counts, projected due/blocking, same-form-version duplicate candidates, and the signed expiring receipt broad audiences must return), `quiz_todo_create` (binds ONE published version to a Project To-do and assigns it — the server computes org id and all content/request hashes; workers see it immediately; `audience` is REQUIRED, ACTIVE / FUTURE / ACTIVE_AND_FUTURE additionally require `preflightReceipt`, SELECTED requires a non-empty duplicate-free list of active same-job contract ids and never auto-assigns future hires, and an exact duplicate of an active item is refused unless `allowDuplicate: true`), `grade` (per-question awards + attempt-tied note), `release` / `bulk_release` (released grades become visible to that worker only), `require_retake` (the canonical RETURN-only retake grant: worker-visible `reason`, REQUIRED `expectedSubmittedAt` stale guard, +1 attempt on the same version), `require_retake_plan` (no-write batch validation returning ordered per-row commands with bounded content-derived keys and a deterministic `planChecksum`), and `require_retake_apply` (request-bound sequential apply of the exact planned rows; refuses live-plan drift with 409 PLAN_STALE). Selective coaching (DEV-2741, distinct from full retakes) rides the same union: `coaching_comment` (draft-batch or immediate feedback on the reviewed attempt), `coaching_redo_selection` (request-bound exact requested-question set), `coaching_draft_cancel`, `coaching_thread_resolve` / `coaching_thread_reopen`, `coaching_accept` (REQUIRED `expectedSubmittedAt`; open published threads 409 unless `acknowledgeOpenThreads`), `coaching_send_back_plan` (NO-WRITE preview minting a signed expiring `planToken` bound to the reviewed draft batch + review state digests), and `coaching_send_back_confirm` (request-bound RETURN of only the requested questions; in-transaction digest CAS fails closed as 409 PLAN_STALE). The coaching subset is documented as the fully discriminated `#/components/schemas/ProjectTodoQuizCoachingManageRequest` / `ProjectTodoQuizCoachingManageResponse` oneOf contracts and wired into this request body. Quiz-as-code and templates (DEV-2678) ride the same union as closed branches: `form_import` (CREATE a job form from an `opentrainQuizVersion: 1` document, idempotent by key, or UPDATE_DRAFT an existing form at `expectedRevision`), `template_create_from_form` (copy a draft or version into an organization template) and `template_instantiate` (a NEW job form from a template; foreign or non-template ids are 404). The two-phase ROLLOUT (DEV-2678) rides the same union as closed branches: `quiz_rollout_plan` (NO-WRITE; read scope; keyless; registry preflight `project_todos.quizzes.rollout.plan`) validates a DRAFT at the reviewed `expectedDraftRevision` or an already-published VERSION together with the To-Do policy, resolves the live audience (masked), reports blockers/warnings/duplicates/notification impact (a released grounding adds a `Grounding:` warning per cited page whose unreleased draft differs or could not be read), and mints a signed 15-minute `plan.token` (digests only: the content hash, a digest of the To-Do policy and the recipient-set hash — never contract ids or text); `quiz_rollout_confirm` (write; client idempotency key REQUIRED; `project_todos.quizzes.rollout.confirm`) takes that token plus the EXACT same `todo` (a difference is 409 `PLAN_TODO_MISMATCH`), re-checks the Project To-dos setting and the live roster BEFORE any write, then publishes the planned draft (or binds the planned version) and creates + assigns the Project To-do, each idempotent under the key (a grounded planned draft needs `instructions:read` on the CONFIRMING key, as `form_publish` does; replays converge on the same ids; the same plan under a second key is 409 `TARGET_ALREADY_MUTATED`), refusing drift with 409 `details.reason: PLAN_STALE` (`details.changed`: roster | projectTodosEnabled | draftRevision | content | archived | job | form; `details.published` names a version this rollout already published — retry with the SAME key to resume it) and bad tokens with 409 `PLAN_TOKEN_INVALID` / `PLAN_TOKEN_EXPIRED` (expiry applies to a first attempt only; completed and resumed rollouts never expire). A grounded `form_validate` or `quiz_rollout_plan` changes nothing users see, but resolving the released view may record the same idempotent effective-view row a worker read records. Every WRITE action requires `project_todos:write` plus `Idempotency-Key`/`idempotencyKey`; the NO-WRITE previews take no key, and the read-scoped plan previews (`require_retake_plan`, `coaching_send_back_plan`, `quiz_rollout_plan` — their own registry preflight operations) are served to `project_todos:read` keys.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "description": "Legacy authoring/grading/retake actions (coaching actions ride the referenced discriminated contract instead).",
                    "required": [
                      "action"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "form_create",
                          "form_update_draft",
                          "form_publish",
                          "form_duplicate",
                          "form_archive",
                          "form_restore",
                          "form_validate",
                          "quiz_todo_preflight",
                          "quiz_todo_create",
                          "grade",
                          "release",
                          "bulk_release",
                          "require_retake",
                          "require_retake_plan",
                          "require_retake_apply"
                        ]
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 128
                      },
                      "preflightReceipt": {
                        "type": "string",
                        "minLength": 16,
                        "maxLength": 8192
                      },
                      "confirmedPlan": {
                        "type": "object",
                        "properties": {
                          "decision": {
                            "type": "object",
                            "properties": {
                              "schemaVersion": {
                                "type": "number",
                                "const": 1
                              },
                              "deliveryPath": {
                                "type": "string",
                                "enum": [
                                  "STANDALONE_FORM",
                                  "COURSE",
                                  "INDIVIDUAL_RETRAINING"
                                ]
                              },
                              "purpose": {
                                "type": "string",
                                "enum": [
                                  "ONBOARDING",
                                  "PRODUCTION_ENABLEMENT",
                                  "REFRESHER",
                                  "CORRECTIVE_RETRAINING",
                                  "QUALIFICATION"
                                ]
                              },
                              "assessment": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "model": {
                                        "type": "string",
                                        "const": "CONTENT_ONLY"
                                      }
                                    },
                                    "required": [
                                      "model"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "model": {
                                        "type": "string",
                                        "const": "FORMATIVE_PRACTICE"
                                      },
                                      "explanationTiming": {
                                        "type": "string",
                                        "const": "AFTER_SUBMISSION"
                                      }
                                    },
                                    "required": [
                                      "model",
                                      "explanationTiming"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "passThresholdPercent": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      },
                                      "attemptLimit": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 10
                                      },
                                      "cooldownStepsSeconds": {
                                        "minItems": 1,
                                        "maxItems": 10,
                                        "type": "array",
                                        "items": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3600
                                        }
                                      },
                                      "restartScope": {
                                        "type": "string",
                                        "enum": [
                                          "WHOLE_MODULE",
                                          "MISSED_QUESTIONS"
                                        ]
                                      },
                                      "resultTiming": {
                                        "type": "string",
                                        "const": "IMMEDIATE"
                                      },
                                      "model": {
                                        "type": "string",
                                        "const": "AUTO_MASTERY"
                                      }
                                    },
                                    "required": [
                                      "passThresholdPercent",
                                      "attemptLimit",
                                      "cooldownStepsSeconds",
                                      "restartScope",
                                      "resultTiming",
                                      "model"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "autoWeightPercent": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99
                                      },
                                      "rubric": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 4000
                                      },
                                      "resultRelease": {
                                        "type": "string",
                                        "enum": [
                                          "IMMEDIATE",
                                          "MANUAL"
                                        ]
                                      },
                                      "returnPolicy": {
                                        "type": "string",
                                        "enum": [
                                          "REVISE_AND_RESUBMIT",
                                          "NO_RETURN"
                                        ]
                                      },
                                      "completionPolicy": {
                                        "type": "string",
                                        "enum": [
                                          "SYSTEM",
                                          "EMPLOYER_REVIEW"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "const": "MIXED_QUALIFICATION"
                                      }
                                    },
                                    "required": [
                                      "autoWeightPercent",
                                      "rubric",
                                      "resultRelease",
                                      "returnPolicy",
                                      "completionPolicy",
                                      "model"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "autoWeightPercent": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99
                                      },
                                      "rubric": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 4000
                                      },
                                      "resultRelease": {
                                        "type": "string",
                                        "enum": [
                                          "IMMEDIATE",
                                          "MANUAL"
                                        ]
                                      },
                                      "returnPolicy": {
                                        "type": "string",
                                        "enum": [
                                          "REVISE_AND_RESUBMIT",
                                          "NO_RETURN"
                                        ]
                                      },
                                      "completionPolicy": {
                                        "type": "string",
                                        "enum": [
                                          "SYSTEM",
                                          "EMPLOYER_REVIEW"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "const": "MANUAL_APPLIED"
                                      }
                                    },
                                    "required": [
                                      "autoWeightPercent",
                                      "rubric",
                                      "resultRelease",
                                      "returnPolicy",
                                      "completionPolicy",
                                      "model"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              "skillGap": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000
                              }
                            },
                            "required": [
                              "schemaVersion",
                              "deliveryPath",
                              "purpose",
                              "assessment"
                            ],
                            "additionalProperties": false
                          },
                          "planHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "confirm": {
                            "type": "boolean",
                            "const": true
                          }
                        },
                        "required": [
                          "decision",
                          "planHash",
                          "confirm"
                        ],
                        "additionalProperties": false
                      },
                      "allowDuplicate": {
                        "type": "boolean"
                      },
                      "jobId": {
                        "type": "string"
                      },
                      "formId": {
                        "type": "string"
                      },
                      "formVersionId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "kind": {
                        "type": "string",
                        "enum": [
                          "FORM",
                          "QUIZ"
                        ]
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "definition": {},
                      "settings": {},
                      "expectedRevision": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "acknowledgeSourceChanges": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "description": "form_update_draft only. Required whenever a page some question cites is re-pinned at a NEW checksum in `definition.grounding`: name every question citing that page (proof you re-read the page and revised the question). Otherwise 409 CONFLICT `details.reason = SOURCE_CHANGED_UNACKNOWLEDGED` listing `movedPins` and `affectedQuestionIds`. Pin each page at the checksum of the read you actually used; uncited pins move freely.",
                        "required": [
                          "questionIds"
                        ],
                        "properties": {
                          "questionIds": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 500,
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "additionalProperties": false
                      },
                      "expectedDraftRevision": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "categoryId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "completionPolicy": {
                        "type": "string",
                        "enum": [
                          "ON_SUBMIT",
                          "ON_PASS",
                          "ON_REVIEW"
                        ]
                      },
                      "audience": {
                        "type": "string",
                        "enum": [
                          "ACTIVE",
                          "FUTURE",
                          "ACTIVE_AND_FUTURE",
                          "SELECTED"
                        ]
                      },
                      "selectedContractIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "priority": {
                        "type": "string",
                        "enum": [
                          "LOW",
                          "NORMAL",
                          "HIGH",
                          "URGENT"
                        ]
                      },
                      "blockingMode": {
                        "type": "string",
                        "enum": [
                          "NONE",
                          "IMMEDIATE",
                          "DEADLINE"
                        ]
                      },
                      "dueOffsetMinutes": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 1
                      },
                      "attemptId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "assignmentId": {
                        "type": "string"
                      },
                      "grades": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "object",
                          "required": [
                            "questionId",
                            "awardedPoints"
                          ],
                          "properties": {
                            "questionId": {
                              "type": "string"
                            },
                            "awardedPoints": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10000
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "note": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "provenance": {
                        "type": "object",
                        "description": "grade: who/how graded (AGENT | HUMAN, model, provider, confidence, rubricVersion, humanReviewed) — recorded on the GRADE_REVISED audit event and read back on the attempt history and the grading packet.",
                        "required": [
                          "grader"
                        ],
                        "properties": {
                          "grader": {
                            "type": "string",
                            "enum": [
                              "AGENT",
                              "HUMAN"
                            ]
                          },
                          "model": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "provider": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "confidence": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          },
                          "rubricVersion": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "humanReviewed": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": false
                      },
                      "reason": {
                        "type": "string",
                        "description": "Worker-visible individualized correction."
                      },
                      "expectedSubmittedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "planChecksum": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 128,
                        "description": "require_retake_apply: deterministic checksum from the plan."
                      },
                      "confirmLive": {
                        "type": "boolean",
                        "description": "require_retake_apply: must be exactly true."
                      },
                      "rows": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "object",
                          "required": [
                            "rowKey",
                            "assignmentId",
                            "reason",
                            "expectedSubmittedAt"
                          ],
                          "properties": {
                            "rowKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "assignmentId": {
                              "type": "string"
                            },
                            "attemptId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "expectedSubmittedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "grade": {
                              "oneOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "grades"
                                  ],
                                  "properties": {
                                    "grades": {
                                      "type": "array",
                                      "maxItems": 500,
                                      "items": {
                                        "type": "object",
                                        "required": [
                                          "questionId",
                                          "awardedPoints"
                                        ],
                                        "properties": {
                                          "questionId": {
                                            "type": "string"
                                          },
                                          "awardedPoints": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 10000
                                          }
                                        },
                                        "additionalProperties": false
                                      }
                                    },
                                    "note": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "maxLength": 5000
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "release": {
                              "type": "boolean"
                            }
                          },
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "description": "Patch the CURRENT draft question by question at expectedRevision (write; client idempotency key REQUIRED; receipt-replayed like form_update_draft). operations apply in order — add, update (one whole question), remove, move (reorder) — keyed by the author’s stable question ids; title, description and settings are unchanged. A stale expectedRevision is 409 CONFLICT before anything else; an unknown id, a duplicate add, a move after itself or an invalid question is 400 BAD_REQUEST (details.reason, details.operationIndex, details.questionId) and nothing is written. The patched draft then runs through the same draft service as form_update_draft: normalization, the media-asset gate, and 409 SOURCE_CHANGED_UNACKNOWLEDGED when a re-pinned cited page is not acknowledged.",
                    "required": [
                      "action",
                      "idempotencyKey",
                      "formId",
                      "expectedRevision",
                      "operations"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "form_patch_draft"
                        ]
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 128,
                        "pattern": "^[A-Za-z0-9._:-]+$"
                      },
                      "formId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "expectedRevision": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "operations": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 200,
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "description": "Insert one whole question (its id must be new to the draft).",
                              "required": [
                                "op",
                                "question",
                                "afterQuestionId"
                              ],
                              "properties": {
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "add"
                                  ]
                                },
                                "question": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "SHORT_TEXT"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "string",
                                                  "maxLength": 10000
                                                },
                                                "caseSensitive": {
                                                  "default": false,
                                                  "type": "boolean"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "PARAGRAPH"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "string",
                                                  "maxLength": 10000
                                                },
                                                "caseSensitive": {
                                                  "default": false,
                                                  "type": "boolean"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "MULTIPLE_CHOICE"
                                        },
                                        "options": {
                                          "minItems": 2,
                                          "maxItems": 200,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "label": {
                                                "type": "string",
                                                "maxLength": 500
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "label"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "optionId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                }
                                              },
                                              "required": [
                                                "optionId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "options"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "CHECKBOXES"
                                        },
                                        "options": {
                                          "minItems": 1,
                                          "maxItems": 200,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "label": {
                                                "type": "string",
                                                "maxLength": 500
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "label"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "optionIds": {
                                                  "minItems": 1,
                                                  "maxItems": 200,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  }
                                                }
                                              },
                                              "required": [
                                                "optionIds"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "options"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "DROPDOWN"
                                        },
                                        "options": {
                                          "minItems": 2,
                                          "maxItems": 200,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "label": {
                                                "type": "string",
                                                "maxLength": 500
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "label"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "optionId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                }
                                              },
                                              "required": [
                                                "optionId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "options"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "LINEAR_SCALE"
                                        },
                                        "min": {
                                          "type": "integer",
                                          "minimum": -100,
                                          "maximum": 100
                                        },
                                        "max": {
                                          "type": "integer",
                                          "minimum": -100,
                                          "maximum": 100
                                        },
                                        "minLabel": {
                                          "type": "string",
                                          "maxLength": 200
                                        },
                                        "maxLabel": {
                                          "type": "string",
                                          "maxLength": 200
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "number"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "tolerance": {
                                              "type": "number",
                                              "minimum": 0
                                            },
                                            "partialCredit": {
                                              "type": "string",
                                              "enum": [
                                                "NONE",
                                                "LINEAR"
                                              ]
                                            },
                                            "partialCreditRange": {
                                              "type": "number",
                                              "exclusiveMinimum": 0
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "min",
                                        "max"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "NUMBER"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "number"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "tolerance": {
                                              "type": "number",
                                              "minimum": 0
                                            },
                                            "partialCredit": {
                                              "type": "string",
                                              "enum": [
                                                "NONE",
                                                "LINEAR"
                                              ]
                                            },
                                            "partialCreditRange": {
                                              "type": "number",
                                              "exclusiveMinimum": 0
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "DATE"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "string",
                                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "SECTION"
                                        },
                                        "title": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "description": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "descriptionDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "title"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "TITLE"
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "textDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "text"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "afterQuestionId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 120,
                                  "description": "Place the question right after this question id; null = first."
                                }
                              },
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "description": "Replace one whole question. question.id may be omitted; when given it must equal questionId (an id change is remove + add).",
                              "required": [
                                "op",
                                "questionId",
                                "question"
                              ],
                              "properties": {
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "update"
                                  ]
                                },
                                "questionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "question": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "SHORT_TEXT"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "string",
                                                  "maxLength": 10000
                                                },
                                                "caseSensitive": {
                                                  "default": false,
                                                  "type": "boolean"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "PARAGRAPH"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "string",
                                                  "maxLength": 10000
                                                },
                                                "caseSensitive": {
                                                  "default": false,
                                                  "type": "boolean"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "MULTIPLE_CHOICE"
                                        },
                                        "options": {
                                          "minItems": 2,
                                          "maxItems": 200,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "label": {
                                                "type": "string",
                                                "maxLength": 500
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "label"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "optionId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                }
                                              },
                                              "required": [
                                                "optionId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "options"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "CHECKBOXES"
                                        },
                                        "options": {
                                          "minItems": 1,
                                          "maxItems": 200,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "label": {
                                                "type": "string",
                                                "maxLength": 500
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "label"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "optionIds": {
                                                  "minItems": 1,
                                                  "maxItems": 200,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  }
                                                }
                                              },
                                              "required": [
                                                "optionIds"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "options"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "DROPDOWN"
                                        },
                                        "options": {
                                          "minItems": 2,
                                          "maxItems": 200,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "label": {
                                                "type": "string",
                                                "maxLength": 500
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "label"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "optionId": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 120
                                                }
                                              },
                                              "required": [
                                                "optionId"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "options"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "LINEAR_SCALE"
                                        },
                                        "min": {
                                          "type": "integer",
                                          "minimum": -100,
                                          "maximum": 100
                                        },
                                        "max": {
                                          "type": "integer",
                                          "minimum": -100,
                                          "maximum": 100
                                        },
                                        "minLabel": {
                                          "type": "string",
                                          "maxLength": 200
                                        },
                                        "maxLabel": {
                                          "type": "string",
                                          "maxLength": 200
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "number"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "tolerance": {
                                              "type": "number",
                                              "minimum": 0
                                            },
                                            "partialCredit": {
                                              "type": "string",
                                              "enum": [
                                                "NONE",
                                                "LINEAR"
                                              ]
                                            },
                                            "partialCreditRange": {
                                              "type": "number",
                                              "exclusiveMinimum": 0
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type",
                                        "min",
                                        "max"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "NUMBER"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "number"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "tolerance": {
                                              "type": "number",
                                              "minimum": 0
                                            },
                                            "partialCredit": {
                                              "type": "string",
                                              "enum": [
                                                "NONE",
                                                "LINEAR"
                                              ]
                                            },
                                            "partialCreditRange": {
                                              "type": "number",
                                              "exclusiveMinimum": 0
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "prompt": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "promptDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        },
                                        "required": {
                                          "type": "boolean"
                                        },
                                        "manualGrading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "rubric": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            }
                                          },
                                          "required": [
                                            "points"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "practiceExplanation": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 4000
                                        },
                                        "sourceRefs": {
                                          "maxItems": 20,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "pageId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "nodeId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              }
                                            },
                                            "required": [
                                              "pageId",
                                              "nodeId"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "rationale": {
                                          "type": "string",
                                          "maxLength": 2000
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "DATE"
                                        },
                                        "grading": {
                                          "type": "object",
                                          "properties": {
                                            "points": {
                                              "default": 1,
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 10000
                                            },
                                            "answerKey": {
                                              "type": "object",
                                              "properties": {
                                                "value": {
                                                  "type": "string",
                                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                                }
                                              },
                                              "required": [
                                                "value"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "answerKey"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "prompt",
                                        "required",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "SECTION"
                                        },
                                        "title": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "description": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "descriptionDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "title"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "TITLE"
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 10000
                                        },
                                        "textDoc": {
                                          "type": "object",
                                          "description": "TipTap rich document (extensible; validated in depth by the server).",
                                          "additionalProperties": {}
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "text"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "description": "Remove one question.",
                              "required": [
                                "op",
                                "questionId"
                              ],
                              "properties": {
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "remove"
                                  ]
                                },
                                "questionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                }
                              },
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "description": "Move one question (this is reorder).",
                              "required": [
                                "op",
                                "questionId",
                                "afterQuestionId"
                              ],
                              "properties": {
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "move"
                                  ]
                                },
                                "questionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "afterQuestionId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 120,
                                  "description": "Place the question right after this question id; null = first."
                                }
                              },
                              "additionalProperties": false
                            }
                          ],
                          "discriminator": {
                            "propertyName": "op"
                          }
                        }
                      },
                      "acknowledgeSourceChanges": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "description": "Required whenever an updated or added question cites a page re-pinned at a NEW checksum: name every question citing that page, exactly like form_update_draft. Otherwise 409 CONFLICT details.reason = SOURCE_CHANGED_UNACKNOWLEDGED.",
                        "required": [
                          "questionIds"
                        ],
                        "properties": {
                          "questionIds": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 500,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "description": "Import a quiz-as-code document (write; client idempotency key REQUIRED; receipt-replayed): CREATE a new job form (the committed create is recovered by key before anything is re-read; a reused key with a different document or job is 409 IDEMPOTENCY_KEY_REUSED; takes the same optional confirmedPlan as form_create) or UPDATE_DRAFT an existing form at expectedRevision (the stored authoringDecision is preserved).",
                    "required": [
                      "action",
                      "idempotencyKey",
                      "document",
                      "target"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "form_import"
                        ]
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 128,
                        "pattern": "^[A-Za-z0-9._:-]+$"
                      },
                      "document": {
                        "type": "object",
                        "description": "Portable quiz-as-code document: exactly the PORTABLE authoring content under an opentrainQuizVersion envelope — never ids, timestamps, scope, revisions, assets, attempts, nor the server-owned settings.authoringDecision (the confirmed learning-plan decision is minted per form on create and preserved on update; it never travels in a document). Question/option ids are the author’s stable identifiers and survive export → edit → import.",
                        "required": [
                          "opentrainQuizVersion",
                          "title",
                          "settings",
                          "definition"
                        ],
                        "properties": {
                          "opentrainQuizVersion": {
                            "type": "number",
                            "enum": [
                              1
                            ]
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 10000
                          },
                          "descriptionDoc": {
                            "description": "Optional rich description (TipTap JSON); the plain description is re-derived."
                          },
                          "settings": {
                            "type": "object",
                            "properties": {
                              "attemptPolicy": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "mode": {
                                        "type": "string",
                                        "const": "UNLIMITED"
                                      }
                                    },
                                    "required": [
                                      "mode"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "mode": {
                                        "type": "string",
                                        "const": "LIMITED"
                                      },
                                      "maxAttempts": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 10000
                                      }
                                    },
                                    "required": [
                                      "mode",
                                      "maxAttempts"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              "passRule": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "mode": {
                                            "type": "string",
                                            "const": "PERCENTAGE"
                                          },
                                          "thresholdPercent": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 100
                                          }
                                        },
                                        "required": [
                                          "mode",
                                          "thresholdPercent"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "mode": {
                                            "type": "string",
                                            "const": "ABSOLUTE"
                                          },
                                          "thresholdPoints": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 1000000
                                          }
                                        },
                                        "required": [
                                          "mode",
                                          "thresholdPoints"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "resultRelease": {
                                "type": "string",
                                "enum": [
                                  "IMMEDIATE",
                                  "MANUAL"
                                ]
                              }
                            },
                            "required": [
                              "attemptPolicy",
                              "passRule",
                              "resultRelease"
                            ],
                            "additionalProperties": false,
                            "description": "The portable Native Forms settings (attemptPolicy, passRule, resultRelease); closed — never authoringDecision."
                          },
                          "definition": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "schemaVersion": {
                                    "type": "number",
                                    "const": 1
                                  },
                                  "questions": {
                                    "maxItems": 500,
                                    "type": "array",
                                    "items": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "SHORT_TEXT"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "string",
                                                      "maxLength": 10000
                                                    },
                                                    "caseSensitive": {
                                                      "default": false,
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "PARAGRAPH"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "string",
                                                      "maxLength": 10000
                                                    },
                                                    "caseSensitive": {
                                                      "default": false,
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "MULTIPLE_CHOICE"
                                            },
                                            "options": {
                                              "minItems": 2,
                                              "maxItems": 200,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "label": {
                                                    "type": "string",
                                                    "maxLength": 500
                                                  }
                                                },
                                                "required": [
                                                  "id",
                                                  "label"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "optionId": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    }
                                                  },
                                                  "required": [
                                                    "optionId"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "options"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "CHECKBOXES"
                                            },
                                            "options": {
                                              "minItems": 1,
                                              "maxItems": 200,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "label": {
                                                    "type": "string",
                                                    "maxLength": 500
                                                  }
                                                },
                                                "required": [
                                                  "id",
                                                  "label"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "optionIds": {
                                                      "minItems": 1,
                                                      "maxItems": 200,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "string",
                                                        "minLength": 1,
                                                        "maxLength": 120
                                                      }
                                                    }
                                                  },
                                                  "required": [
                                                    "optionIds"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "options"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "DROPDOWN"
                                            },
                                            "options": {
                                              "minItems": 2,
                                              "maxItems": 200,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "label": {
                                                    "type": "string",
                                                    "maxLength": 500
                                                  }
                                                },
                                                "required": [
                                                  "id",
                                                  "label"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "optionId": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    }
                                                  },
                                                  "required": [
                                                    "optionId"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "options"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "LINEAR_SCALE"
                                            },
                                            "min": {
                                              "type": "integer",
                                              "minimum": -100,
                                              "maximum": 100
                                            },
                                            "max": {
                                              "type": "integer",
                                              "minimum": -100,
                                              "maximum": 100
                                            },
                                            "minLabel": {
                                              "type": "string",
                                              "maxLength": 200
                                            },
                                            "maxLabel": {
                                              "type": "string",
                                              "maxLength": 200
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "number"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "tolerance": {
                                                  "type": "number",
                                                  "minimum": 0
                                                },
                                                "partialCredit": {
                                                  "type": "string",
                                                  "enum": [
                                                    "NONE",
                                                    "LINEAR"
                                                  ]
                                                },
                                                "partialCreditRange": {
                                                  "type": "number",
                                                  "exclusiveMinimum": 0
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "min",
                                            "max"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "NUMBER"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "number"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "tolerance": {
                                                  "type": "number",
                                                  "minimum": 0
                                                },
                                                "partialCredit": {
                                                  "type": "string",
                                                  "enum": [
                                                    "NONE",
                                                    "LINEAR"
                                                  ]
                                                },
                                                "partialCreditRange": {
                                                  "type": "number",
                                                  "exclusiveMinimum": 0
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "DATE"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "string",
                                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "SECTION"
                                            },
                                            "title": {
                                              "type": "string",
                                              "maxLength": 500
                                            },
                                            "description": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "descriptionDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "type",
                                            "title"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "TITLE"
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "textDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "type",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "schemaVersion",
                                  "questions"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "schemaVersion": {
                                    "type": "number",
                                    "const": 2
                                  },
                                  "questions": {
                                    "maxItems": 500,
                                    "type": "array",
                                    "items": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "SHORT_TEXT"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "string",
                                                      "maxLength": 10000
                                                    },
                                                    "caseSensitive": {
                                                      "default": false,
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "PARAGRAPH"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "string",
                                                      "maxLength": 10000
                                                    },
                                                    "caseSensitive": {
                                                      "default": false,
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "MULTIPLE_CHOICE"
                                            },
                                            "options": {
                                              "minItems": 2,
                                              "maxItems": 200,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "label": {
                                                    "type": "string",
                                                    "maxLength": 500
                                                  }
                                                },
                                                "required": [
                                                  "id",
                                                  "label"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "optionId": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    }
                                                  },
                                                  "required": [
                                                    "optionId"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "options"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "CHECKBOXES"
                                            },
                                            "options": {
                                              "minItems": 1,
                                              "maxItems": 200,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "label": {
                                                    "type": "string",
                                                    "maxLength": 500
                                                  }
                                                },
                                                "required": [
                                                  "id",
                                                  "label"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "optionIds": {
                                                      "minItems": 1,
                                                      "maxItems": 200,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "string",
                                                        "minLength": 1,
                                                        "maxLength": 120
                                                      }
                                                    }
                                                  },
                                                  "required": [
                                                    "optionIds"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "options"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "DROPDOWN"
                                            },
                                            "options": {
                                              "minItems": 2,
                                              "maxItems": 200,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "id": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "label": {
                                                    "type": "string",
                                                    "maxLength": 500
                                                  }
                                                },
                                                "required": [
                                                  "id",
                                                  "label"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "optionId": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    }
                                                  },
                                                  "required": [
                                                    "optionId"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "options"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "LINEAR_SCALE"
                                            },
                                            "min": {
                                              "type": "integer",
                                              "minimum": -100,
                                              "maximum": 100
                                            },
                                            "max": {
                                              "type": "integer",
                                              "minimum": -100,
                                              "maximum": 100
                                            },
                                            "minLabel": {
                                              "type": "string",
                                              "maxLength": 200
                                            },
                                            "maxLabel": {
                                              "type": "string",
                                              "maxLength": 200
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "number"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "tolerance": {
                                                  "type": "number",
                                                  "minimum": 0
                                                },
                                                "partialCredit": {
                                                  "type": "string",
                                                  "enum": [
                                                    "NONE",
                                                    "LINEAR"
                                                  ]
                                                },
                                                "partialCreditRange": {
                                                  "type": "number",
                                                  "exclusiveMinimum": 0
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type",
                                            "min",
                                            "max"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "NUMBER"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "number"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "tolerance": {
                                                  "type": "number",
                                                  "minimum": 0
                                                },
                                                "partialCredit": {
                                                  "type": "string",
                                                  "enum": [
                                                    "NONE",
                                                    "LINEAR"
                                                  ]
                                                },
                                                "partialCreditRange": {
                                                  "type": "number",
                                                  "exclusiveMinimum": 0
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "prompt": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "promptDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            },
                                            "required": {
                                              "type": "boolean"
                                            },
                                            "manualGrading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "rubric": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 4000
                                                }
                                              },
                                              "required": [
                                                "points"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "practiceExplanation": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 4000
                                            },
                                            "sourceRefs": {
                                              "maxItems": 20,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "pageId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 120
                                                  },
                                                  "nodeId": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  }
                                                },
                                                "required": [
                                                  "pageId",
                                                  "nodeId"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "rationale": {
                                              "type": "string",
                                              "maxLength": 2000
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "DATE"
                                            },
                                            "grading": {
                                              "type": "object",
                                              "properties": {
                                                "points": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 10000
                                                },
                                                "answerKey": {
                                                  "type": "object",
                                                  "properties": {
                                                    "value": {
                                                      "type": "string",
                                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "value"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "answerKey"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "prompt",
                                            "required",
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "SECTION"
                                            },
                                            "title": {
                                              "type": "string",
                                              "maxLength": 500
                                            },
                                            "description": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "descriptionDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "type",
                                            "title"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "type": {
                                              "type": "string",
                                              "const": "TITLE"
                                            },
                                            "text": {
                                              "type": "string",
                                              "maxLength": 10000
                                            },
                                            "textDoc": {
                                              "type": "object",
                                              "description": "TipTap rich document (extensible; validated in depth by the server).",
                                              "additionalProperties": {}
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "type",
                                            "text"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "grounding": {
                                    "type": "object",
                                    "properties": {
                                      "jobId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      },
                                      "instructionSetId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      },
                                      "treeChecksum": {
                                        "type": "string",
                                        "minLength": 8,
                                        "maxLength": 128
                                      },
                                      "pages": {
                                        "minItems": 1,
                                        "maxItems": 200,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "pageId": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 120
                                            },
                                            "checksum": {
                                              "type": "string",
                                              "minLength": 8,
                                              "maxLength": 128
                                            }
                                          },
                                          "required": [
                                            "pageId",
                                            "checksum"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "capturedAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "source": {
                                        "type": "string",
                                        "enum": [
                                          "released",
                                          "draft_preview"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "jobId",
                                      "instructionSetId",
                                      "treeChecksum",
                                      "pages",
                                      "capturedAt"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "schemaVersion",
                                  "questions"
                                ],
                                "additionalProperties": false
                              }
                            ],
                            "description": "The Native Forms definition (schemaVersion 1 | 2, the closed question union with stable ids, optional grounding on v2); rich documents (promptDoc / descriptionDoc / textDoc) are the only open nodes."
                          }
                        },
                        "additionalProperties": false
                      },
                      "target": {
                        "oneOf": [
                          {
                            "type": "object",
                            "required": [
                              "kind",
                              "jobId"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "CREATE"
                                ]
                              },
                              "jobId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "confirmedPlan": {
                                "type": "object",
                                "properties": {
                                  "decision": {
                                    "type": "object",
                                    "properties": {
                                      "schemaVersion": {
                                        "type": "number",
                                        "const": 1
                                      },
                                      "deliveryPath": {
                                        "type": "string",
                                        "enum": [
                                          "STANDALONE_FORM",
                                          "COURSE",
                                          "INDIVIDUAL_RETRAINING"
                                        ]
                                      },
                                      "purpose": {
                                        "type": "string",
                                        "enum": [
                                          "ONBOARDING",
                                          "PRODUCTION_ENABLEMENT",
                                          "REFRESHER",
                                          "CORRECTIVE_RETRAINING",
                                          "QUALIFICATION"
                                        ]
                                      },
                                      "assessment": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "model": {
                                                "type": "string",
                                                "const": "CONTENT_ONLY"
                                              }
                                            },
                                            "required": [
                                              "model"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "model": {
                                                "type": "string",
                                                "const": "FORMATIVE_PRACTICE"
                                              },
                                              "explanationTiming": {
                                                "type": "string",
                                                "const": "AFTER_SUBMISSION"
                                              }
                                            },
                                            "required": [
                                              "model",
                                              "explanationTiming"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "passThresholdPercent": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 100
                                              },
                                              "attemptLimit": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 10
                                              },
                                              "cooldownStepsSeconds": {
                                                "minItems": 1,
                                                "maxItems": 10,
                                                "type": "array",
                                                "items": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 3600
                                                }
                                              },
                                              "restartScope": {
                                                "type": "string",
                                                "enum": [
                                                  "WHOLE_MODULE",
                                                  "MISSED_QUESTIONS"
                                                ]
                                              },
                                              "resultTiming": {
                                                "type": "string",
                                                "const": "IMMEDIATE"
                                              },
                                              "model": {
                                                "type": "string",
                                                "const": "AUTO_MASTERY"
                                              }
                                            },
                                            "required": [
                                              "passThresholdPercent",
                                              "attemptLimit",
                                              "cooldownStepsSeconds",
                                              "restartScope",
                                              "resultTiming",
                                              "model"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "autoWeightPercent": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              },
                                              "resultRelease": {
                                                "type": "string",
                                                "enum": [
                                                  "IMMEDIATE",
                                                  "MANUAL"
                                                ]
                                              },
                                              "returnPolicy": {
                                                "type": "string",
                                                "enum": [
                                                  "REVISE_AND_RESUBMIT",
                                                  "NO_RETURN"
                                                ]
                                              },
                                              "completionPolicy": {
                                                "type": "string",
                                                "enum": [
                                                  "SYSTEM",
                                                  "EMPLOYER_REVIEW"
                                                ]
                                              },
                                              "model": {
                                                "type": "string",
                                                "const": "MIXED_QUALIFICATION"
                                              }
                                            },
                                            "required": [
                                              "autoWeightPercent",
                                              "rubric",
                                              "resultRelease",
                                              "returnPolicy",
                                              "completionPolicy",
                                              "model"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "autoWeightPercent": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99
                                              },
                                              "rubric": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 4000
                                              },
                                              "resultRelease": {
                                                "type": "string",
                                                "enum": [
                                                  "IMMEDIATE",
                                                  "MANUAL"
                                                ]
                                              },
                                              "returnPolicy": {
                                                "type": "string",
                                                "enum": [
                                                  "REVISE_AND_RESUBMIT",
                                                  "NO_RETURN"
                                                ]
                                              },
                                              "completionPolicy": {
                                                "type": "string",
                                                "enum": [
                                                  "SYSTEM",
                                                  "EMPLOYER_REVIEW"
                                                ]
                                              },
                                              "model": {
                                                "type": "string",
                                                "const": "MANUAL_APPLIED"
                                              }
                                            },
                                            "required": [
                                              "autoWeightPercent",
                                              "rubric",
                                              "resultRelease",
                                              "returnPolicy",
                                              "completionPolicy",
                                              "model"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ]
                                      },
                                      "skillGap": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      }
                                    },
                                    "required": [
                                      "schemaVersion",
                                      "deliveryPath",
                                      "purpose",
                                      "assessment"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "planHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "confirm": {
                                    "type": "boolean",
                                    "const": true
                                  }
                                },
                                "required": [
                                  "decision",
                                  "planHash",
                                  "confirm"
                                ],
                                "additionalProperties": false,
                                "description": "Main’s learning-plan policy, exactly as form_create: the confirmed decision + planHash from lms authoring plan; a supplied invalid or foreign plan is refused, omission is allowed until the operator enforces plans. The document never carries the decision."
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "required": [
                              "kind",
                              "formId",
                              "expectedRevision"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "UPDATE_DRAFT"
                                ]
                              },
                              "formId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "expectedRevision": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "acknowledgeSourceChanges": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "description": "Required whenever the imported document re-pins a page some question cites at a NEW checksum (definition.grounding): name every question citing that page, exactly like form_update_draft. Otherwise 409 CONFLICT details.reason = SOURCE_CHANGED_UNACKNOWLEDGED with details.movedPins.",
                                "required": [
                                  "questionIds"
                                ],
                                "properties": {
                                  "questionIds": {
                                    "type": "array",
                                    "minItems": 1,
                                    "maxItems": 500,
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "additionalProperties": false
                          }
                        ],
                        "discriminator": {
                          "propertyName": "kind"
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "description": "Copy a form’s current draft (or a published version) into an organization template (write; client idempotency key REQUIRED; receipt-replayed — the committed create is recovered by key BEFORE the source is re-read, so a retry after the source changed returns the original template; the same key naming another source form/version is 409 IDEMPOTENCY_KEY_REUSED). A source grounded in its job’s Instructions is refused (400 GROUNDED_SOURCE) unless detachGrounding: true opts into the portable projection. The source’s existing authoringDecision travels with the copy, as on duplication.",
                    "required": [
                      "action",
                      "idempotencyKey",
                      "formId"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "template_create_from_form"
                        ]
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 128,
                        "pattern": "^[A-Za-z0-9._:-]+$"
                      },
                      "formId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "formVersionId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                      },
                      "detachGrounding": {
                        "type": "boolean",
                        "description": "Opt-in portable projection of a grounded source: the grounding capture and every question’s sourceRefs are removed (the job-bound provenance); answer rationale text is kept. Without it a grounded source is 400 BAD_REQUEST details.reason = GROUNDED_SOURCE."
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "description": "Create a NEW job-scoped form from an organization template (write; client idempotency key REQUIRED; idempotent by key). The template is never linked or mutated; a foreign or non-template id is 404.",
                    "required": [
                      "action",
                      "idempotencyKey",
                      "templateId",
                      "jobId"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "template_instantiate"
                        ]
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 128,
                        "pattern": "^[A-Za-z0-9._:-]+$"
                      },
                      "templateId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "jobId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "description": "NO-WRITE rollout plan (registry preflight project_todos.quizzes.rollout.plan; read scope; keyless). Validates the source + To-Do policy, resolves the live audience, and mints a signed expiring plan token when publishable.",
                    "required": [
                      "action",
                      "jobId",
                      "formId",
                      "source",
                      "todo"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "quiz_rollout_plan"
                        ]
                      },
                      "jobId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "formId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "source": {
                        "oneOf": [
                          {
                            "type": "object",
                            "description": "Publish the current draft at the revision the agent reviewed, then bind it.",
                            "required": [
                              "kind",
                              "expectedDraftRevision"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "DRAFT"
                                ]
                              },
                              "expectedDraftRevision": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "description": "Bind an already-published immutable version (no publish).",
                            "required": [
                              "kind",
                              "formVersionId"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "VERSION"
                                ]
                              },
                              "formVersionId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "additionalProperties": false
                          }
                        ],
                        "discriminator": {
                          "propertyName": "kind"
                        }
                      },
                      "todo": {
                        "type": "object",
                        "description": "The To-Do configuration the agent reviewed with the user. Required: completionPolicy and audience. Defaults: required true, priority URGENT, blockingMode IMMEDIATE, title/description from the form.",
                        "required": [
                          "completionPolicy",
                          "audience"
                        ],
                        "properties": {
                          "categoryId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "completionPolicy": {
                            "type": "string",
                            "enum": [
                              "ON_SUBMIT",
                              "ON_PASS",
                              "ON_REVIEW"
                            ]
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 180
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 5000
                          },
                          "audience": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "FUTURE",
                              "ACTIVE_AND_FUTURE",
                              "SELECTED"
                            ]
                          },
                          "selectedContractIds": {
                            "type": "array",
                            "maxItems": 500,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": {
                            "type": "boolean"
                          },
                          "priority": {
                            "type": "string",
                            "enum": [
                              "NORMAL",
                              "HIGH",
                              "URGENT"
                            ]
                          },
                          "blockingMode": {
                            "type": "string",
                            "enum": [
                              "NONE",
                              "IMMEDIATE",
                              "AFTER_DUE"
                            ]
                          },
                          "dueOffsetMinutes": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 525600
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "description": "Confirm a planned rollout (registry op project_todos.quizzes.rollout.confirm; write scope; client idempotency key REQUIRED). Re-checks the live roster and Project To-dos setting BEFORE any write, then publishes the planned draft (or binds the planned version) and creates + assigns the Project To-do, each idempotent under the key. The same plan cannot be confirmed under two different keys (409 TARGET_ALREADY_MUTATED).",
                    "required": [
                      "action",
                      "idempotencyKey",
                      "planToken",
                      "todo"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "quiz_rollout_confirm"
                        ]
                      },
                      "idempotencyKey": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 128,
                        "pattern": "^[A-Za-z0-9._:-]+$"
                      },
                      "planToken": {
                        "type": "string",
                        "minLength": 16,
                        "maxLength": 4096,
                        "description": "The signed plan from quiz_rollout_plan (plan.token)."
                      },
                      "todo": {
                        "type": "object",
                        "description": "The EXACT To-Do configuration passed to quiz_rollout_plan (the token signs its digest, never its contract ids or text); any difference is 409 PLAN_TODO_MISMATCH.",
                        "required": [
                          "completionPolicy",
                          "audience"
                        ],
                        "properties": {
                          "categoryId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "completionPolicy": {
                            "type": "string",
                            "enum": [
                              "ON_SUBMIT",
                              "ON_PASS",
                              "ON_REVIEW"
                            ]
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 180
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 5000
                          },
                          "audience": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "FUTURE",
                              "ACTIVE_AND_FUTURE",
                              "SELECTED"
                            ]
                          },
                          "selectedContractIds": {
                            "type": "array",
                            "maxItems": 500,
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": {
                            "type": "boolean"
                          },
                          "priority": {
                            "type": "string",
                            "enum": [
                              "NORMAL",
                              "HIGH",
                              "URGENT"
                            ]
                          },
                          "blockingMode": {
                            "type": "string",
                            "enum": [
                              "NONE",
                              "IMMEDIATE",
                              "AFTER_DUE"
                            ]
                          },
                          "dueOffsetMinutes": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 525600
                          }
                        },
                        "additionalProperties": false
                      },
                      "allowDuplicate": {
                        "type": "boolean",
                        "description": "Explicit override of the exact-duplicate active To-Do refusal."
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "$ref": "#/components/schemas/ProjectTodoQuizCoachingManageRequest"
                  }
                ],
                "discriminator": {
                  "propertyName": "action"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quiz manage result",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "description": "Legacy authoring/grading/single-retake result (action-echoing property bag). Batch plan/apply and selective coaching use closed response branches.",
                      "required": [
                        "action"
                      ],
                      "properties": {
                        "learningPlan": {
                          "type": "object",
                          "properties": {
                            "required": {
                              "type": "boolean",
                              "const": false
                            },
                            "missing": {
                              "type": "boolean",
                              "const": true
                            },
                            "next": {
                              "type": "string",
                              "const": "lms.authoring.plan"
                            }
                          },
                          "required": [
                            "required",
                            "missing",
                            "next"
                          ],
                          "additionalProperties": false
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "form_create",
                            "form_update_draft",
                            "form_publish",
                            "form_duplicate",
                            "form_archive",
                            "form_restore",
                            "quiz_todo_preflight",
                            "quiz_todo_create",
                            "grade",
                            "release",
                            "bulk_release",
                            "require_retake"
                          ]
                        }
                      },
                      "additionalProperties": true
                    },
                    {
                      "type": "object",
                      "description": "Closed NO-WRITE `form_validate` result: every schema, publication-rule and grounding finding at once. `publishable` is false whenever any SCHEMA/PUBLICATION finding or an ERROR grounding finding exists.",
                      "required": [
                        "action",
                        "formId",
                        "draftRevision",
                        "scopeJobId",
                        "publishable",
                        "findings",
                        "publication",
                        "grounding",
                        "affectedQuestionIds"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "form_validate"
                          ]
                        },
                        "formId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "draftRevision": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "scopeJobId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "publishable": {
                          "type": "boolean",
                          "description": "The one verdict. A \"not publishable\" report is still a 200 success (no reserved `ok` field)."
                        },
                        "findings": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "required": [
                                  "source",
                                  "code",
                                  "path",
                                  "message",
                                  "questionId"
                                ],
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "enum": [
                                      "SCHEMA"
                                    ]
                                  },
                                  "code": {
                                    "type": "string",
                                    "enum": [
                                      "INVALID_DEFINITION",
                                      "INVALID_SETTINGS"
                                    ]
                                  },
                                  "path": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "questionId": {
                                    "type": "null"
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "source",
                                  "code",
                                  "path",
                                  "message",
                                  "questionId"
                                ],
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "enum": [
                                      "PUBLICATION"
                                    ]
                                  },
                                  "code": {
                                    "type": "string",
                                    "enum": [
                                      "NO_ANSWERABLE_QUESTION",
                                      "SECTION_TITLE_MISSING",
                                      "TITLE_TEXT_MISSING",
                                      "PROMPT_MISSING",
                                      "OPTION_LABEL_MISSING",
                                      "ANSWER_KEY_EMPTY",
                                      "PASS_RULE_WITHOUT_POINTS",
                                      "ABSOLUTE_THRESHOLD_EXCEEDS_TOTAL",
                                      "FORM_ARCHIVED",
                                      "ASSET_UNUSABLE",
                                      "LEARNING_PLAN_MISMATCH",
                                      "GROUNDING_DRAFT_PREVIEW"
                                    ],
                                    "description": "Content rules plus the gates publish enforces: FORM_ARCHIVED (restore first), ASSET_UNUSABLE (a referenced media asset is missing, still uploading or from another job), LEARNING_PLAN_MISMATCH (the stored confirmed learning plan does not fit this definition/settings — publish would refuse with 409 LEARNING_PLAN_MISMATCH) and GROUNDING_DRAFT_PREVIEW (the grounding was captured from unreleased Instructions — publish refuses with 409 GROUNDING_DRAFT_PREVIEW; release the Instructions, re-capture the grounding, then publish)."
                                  },
                                  "path": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "questionId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "source",
                                  "code",
                                  "severity",
                                  "reason",
                                  "message",
                                  "pageId",
                                  "nodeId",
                                  "questionIds"
                                ],
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "enum": [
                                      "GROUNDING"
                                    ]
                                  },
                                  "code": {
                                    "type": "string",
                                    "enum": [
                                      "SOURCE_CHANGED"
                                    ]
                                  },
                                  "severity": {
                                    "type": "string",
                                    "enum": [
                                      "ERROR",
                                      "WARNING"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "JOB_MISMATCH",
                                      "NO_INSTRUCTIONS",
                                      "INSTRUCTION_SET_CHANGED",
                                      "TREE_CHANGED",
                                      "PAGE_MISSING",
                                      "PAGE_CHANGED",
                                      "NODE_MISSING",
                                      "PAGE_UNREADABLE",
                                      "DRAFT_DIFFERS",
                                      "DRAFT_UNREADABLE"
                                    ]
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "pageId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "nodeId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "questionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "publication": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "required": [
                            "totalPoints",
                            "answerableQuestionCount",
                            "manualQuestionCount",
                            "groundedQuestionCount"
                          ],
                          "properties": {
                            "totalPoints": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "answerableQuestionCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "manualQuestionCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "groundedQuestionCount": {
                              "type": "integer",
                              "minimum": 0
                            }
                          },
                          "additionalProperties": false
                        },
                        "grounding": {
                          "type": "object",
                          "required": [
                            "status",
                            "findings",
                            "live"
                          ],
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "NONE",
                                "VERIFIED",
                                "SOURCE_CHANGED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "draft_preview"
                              ],
                              "description": "Present only when the definition grounding is a draft preview (publish refuses it; see the GROUNDING_DRAFT_PREVIEW finding). Absent for a released grounding or no grounding."
                            },
                            "previewLabel": {
                              "type": "string",
                              "description": "Present only for a `draft_preview` grounding: the preview label to show the user. Absent for released Instructions."
                            },
                            "findings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "description": "One SOURCE_CHANGED finding. ERROR findings block publication and name exactly the questions whose cited pages/blocks drifted (only pages some question cites are read; uncited pins never block); TREE_CHANGED is a WARNING (titles/order moved, cited content checked per page). DRAFT_DIFFERS / DRAFT_UNREADABLE are non-blocking WARNINGs on form_validate only, for a released grounding, sent only to callers whose X-OpenTrain-Features header names quiz-grounding-draft-differs-v1: the unreleased draft of that cited page differs from the released version workers see (or could not be read to compare), so check the named questions against the released text (Instructions page read with released=true), never the draft. GOOGLE_DOC pages never get either (read live: released = draft).",
                                "required": [
                                  "code",
                                  "severity",
                                  "reason",
                                  "message",
                                  "pageId",
                                  "nodeId",
                                  "questionIds"
                                ],
                                "properties": {
                                  "code": {
                                    "type": "string",
                                    "enum": [
                                      "SOURCE_CHANGED"
                                    ]
                                  },
                                  "severity": {
                                    "type": "string",
                                    "enum": [
                                      "ERROR",
                                      "WARNING"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "JOB_MISMATCH",
                                      "NO_INSTRUCTIONS",
                                      "INSTRUCTION_SET_CHANGED",
                                      "TREE_CHANGED",
                                      "PAGE_MISSING",
                                      "PAGE_CHANGED",
                                      "NODE_MISSING",
                                      "PAGE_UNREADABLE",
                                      "DRAFT_DIFFERS",
                                      "DRAFT_UNREADABLE"
                                    ]
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "pageId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "nodeId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "questionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "live": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "description": "Live values for the CITED pinned pages only (the fence reads nothing else). Requires `instructions:read` whenever the definition carries a grounding block.",
                              "required": [
                                "instructionSetId",
                                "treeChecksum",
                                "pages"
                              ],
                              "properties": {
                                "instructionSetId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "treeChecksum": {
                                  "type": "string"
                                },
                                "pages": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "required": [
                                      "pageId",
                                      "checksum"
                                    ],
                                    "properties": {
                                      "pageId": {
                                        "type": "string"
                                      },
                                      "checksum": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "affectedQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "jobId",
                        "rowCount",
                        "valid",
                        "rows",
                        "planChecksum",
                        "note"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "require_retake_plan"
                          ]
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "rowCount": {
                          "type": "integer"
                        },
                        "valid": {
                          "type": "boolean"
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "rowKey",
                              "ok",
                              "error",
                              "snapshot",
                              "commands"
                            ],
                            "properties": {
                              "rowKey": {
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              },
                              "error": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "snapshot": {
                                "oneOf": [
                                  {
                                    "type": "null"
                                  },
                                  {
                                    "type": "object",
                                    "required": [
                                      "assignmentId",
                                      "jobId",
                                      "assignmentStatus",
                                      "completionPolicy",
                                      "submittedAt",
                                      "boundAttemptId",
                                      "attemptStatus",
                                      "gradeState",
                                      "pendingManualQuestionIds",
                                      "latestGradeRevisionNumber",
                                      "resultReleased"
                                    ],
                                    "properties": {
                                      "assignmentId": {
                                        "type": "string"
                                      },
                                      "jobId": {
                                        "type": "string"
                                      },
                                      "assignmentStatus": {
                                        "type": "string",
                                        "enum": [
                                          "OPEN",
                                          "IN_PROGRESS",
                                          "SUBMITTED",
                                          "COMPLETED",
                                          "RETURNED",
                                          "WAIVED",
                                          "CLOSED",
                                          "SUPERSEDED"
                                        ]
                                      },
                                      "completionPolicy": {
                                        "type": "string",
                                        "enum": [
                                          "ON_SUBMIT",
                                          "ON_PASS",
                                          "ON_REVIEW"
                                        ]
                                      },
                                      "submittedAt": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "format": "date-time"
                                      },
                                      "boundAttemptId": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      },
                                      "attemptStatus": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "enum": [
                                          "IN_PROGRESS",
                                          "SUBMITTED",
                                          null
                                        ]
                                      },
                                      "gradeState": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "enum": [
                                          "IN_PROGRESS",
                                          "PENDING_MANUAL",
                                          "GRADED",
                                          null
                                        ]
                                      },
                                      "pendingManualQuestionIds": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      },
                                      "latestGradeRevisionNumber": {
                                        "type": [
                                          "integer",
                                          "null"
                                        ]
                                      },
                                      "resultReleased": {
                                        "type": "boolean"
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              "commands": {
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "required": [
                                        "action",
                                        "idempotencyKey",
                                        "attemptId",
                                        "grades",
                                        "note"
                                      ],
                                      "properties": {
                                        "action": {
                                          "type": "string",
                                          "enum": [
                                            "grade"
                                          ]
                                        },
                                        "idempotencyKey": {
                                          "type": "string"
                                        },
                                        "attemptId": {
                                          "type": "string"
                                        },
                                        "grades": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "required": [
                                              "questionId",
                                              "awardedPoints"
                                            ],
                                            "properties": {
                                              "questionId": {
                                                "type": "string"
                                              },
                                              "awardedPoints": {
                                                "type": "integer"
                                              }
                                            },
                                            "additionalProperties": false
                                          }
                                        },
                                        "note": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "required": [
                                        "action",
                                        "idempotencyKey",
                                        "attemptId"
                                      ],
                                      "properties": {
                                        "action": {
                                          "type": "string",
                                          "enum": [
                                            "release"
                                          ]
                                        },
                                        "idempotencyKey": {
                                          "type": "string"
                                        },
                                        "attemptId": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "required": [
                                        "action",
                                        "idempotencyKey",
                                        "assignmentId",
                                        "attemptId",
                                        "reason",
                                        "expectedSubmittedAt"
                                      ],
                                      "properties": {
                                        "action": {
                                          "type": "string",
                                          "enum": [
                                            "require_retake"
                                          ]
                                        },
                                        "idempotencyKey": {
                                          "type": "string"
                                        },
                                        "assignmentId": {
                                          "type": "string"
                                        },
                                        "attemptId": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "reason": {
                                          "type": "string"
                                        },
                                        "expectedSubmittedAt": {
                                          "type": "string",
                                          "format": "date-time"
                                        }
                                      },
                                      "additionalProperties": false
                                    }
                                  ],
                                  "discriminator": {
                                    "propertyName": "action"
                                  }
                                }
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "planChecksum": {
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "jobId",
                        "ok",
                        "appliedRows",
                        "failedRows",
                        "rows",
                        "note",
                        "replayed"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "require_retake_apply"
                          ]
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "ok": {
                          "type": "boolean"
                        },
                        "appliedRows": {
                          "type": "integer"
                        },
                        "failedRows": {
                          "type": "integer"
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "rowKey",
                              "ok",
                              "error",
                              "commands"
                            ],
                            "properties": {
                              "rowKey": {
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              },
                              "error": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "commands": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "action",
                                    "idempotencyKey",
                                    "ok",
                                    "error"
                                  ],
                                  "properties": {
                                    "action": {
                                      "type": "string",
                                      "enum": [
                                        "grade",
                                        "release",
                                        "require_retake"
                                      ]
                                    },
                                    "idempotencyKey": {
                                      "type": "string"
                                    },
                                    "ok": {
                                      "type": "boolean"
                                    },
                                    "error": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "note": {
                          "type": "string"
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "form",
                        "previousRevision",
                        "contentHash",
                        "diff",
                        "replayed"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "form_patch_draft"
                          ]
                        },
                        "form": {
                          "type": "object",
                          "required": [
                            "id",
                            "title",
                            "description",
                            "scopeJobId",
                            "draftRevision",
                            "archivedAt",
                            "updatedAt",
                            "latestVersion"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "scopeJobId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "null = organization template."
                            },
                            "draftRevision": {
                              "type": "integer"
                            },
                            "archivedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "latestVersion": {
                              "oneOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "id",
                                    "versionNumber",
                                    "publishedAt",
                                    "contentHash"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "versionNumber": {
                                      "type": "integer"
                                    },
                                    "publishedAt": {
                                      "type": "string",
                                      "format": "date-time"
                                    },
                                    "contentHash": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "additionalProperties": false,
                          "description": "The form after the patch; form.draftRevision is the new revision."
                        },
                        "previousRevision": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "contentHash": {
                          "type": "string",
                          "description": "The PORTABLE content hash: hashNativeFormPublication over the document’s content (settings without the server-owned authoringDecision, the definition as stored). It identifies portable content across export → edit → import; it is NOT the hash a publication records (publishing prunes uncited grounding pins and refreshes the tree checksum, and a stored authoringDecision is part of the recorded settings) — see recordedContentHash."
                        },
                        "diff": {
                          "type": "object",
                          "required": [
                            "title",
                            "description",
                            "descriptionDoc",
                            "settings",
                            "definition",
                            "questions",
                            "affectedQuestionIds",
                            "identical"
                          ],
                          "properties": {
                            "title": {
                              "type": "object",
                              "required": [
                                "changed",
                                "from",
                                "to"
                              ],
                              "properties": {
                                "changed": {
                                  "type": "boolean"
                                },
                                "from": {
                                  "type": "string"
                                },
                                "to": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": false
                            },
                            "description": {
                              "type": "object",
                              "required": [
                                "changed",
                                "from",
                                "to"
                              ],
                              "properties": {
                                "changed": {
                                  "type": "boolean"
                                },
                                "from": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "to": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "additionalProperties": false
                            },
                            "descriptionDoc": {
                              "type": "object",
                              "required": [
                                "changed"
                              ],
                              "properties": {
                                "changed": {
                                  "type": "boolean"
                                }
                              },
                              "additionalProperties": false
                            },
                            "settings": {
                              "type": "object",
                              "required": [
                                "changed",
                                "fields"
                              ],
                              "properties": {
                                "changed": {
                                  "type": "boolean"
                                },
                                "fields": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              },
                              "additionalProperties": false
                            },
                            "definition": {
                              "type": "object",
                              "required": [
                                "schemaVersion",
                                "grounding"
                              ],
                              "properties": {
                                "schemaVersion": {
                                  "type": "object",
                                  "required": [
                                    "changed",
                                    "from",
                                    "to"
                                  ],
                                  "properties": {
                                    "changed": {
                                      "type": "boolean"
                                    },
                                    "from": {
                                      "type": "number",
                                      "enum": [
                                        1,
                                        2
                                      ]
                                    },
                                    "to": {
                                      "type": "number",
                                      "enum": [
                                        1,
                                        2
                                      ]
                                    }
                                  },
                                  "additionalProperties": false
                                },
                                "grounding": {
                                  "type": "object",
                                  "required": [
                                    "changed"
                                  ],
                                  "properties": {
                                    "changed": {
                                      "type": "boolean"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              "additionalProperties": false
                            },
                            "questions": {
                              "type": "object",
                              "required": [
                                "added",
                                "removed",
                                "changed",
                                "unchanged",
                                "reordered",
                                "orderFrom",
                                "orderTo"
                              ],
                              "properties": {
                                "added": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "removed": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "changed": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "required": [
                                      "id",
                                      "fields"
                                    ],
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "fields": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                },
                                "unchanged": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "reordered": {
                                  "type": "boolean"
                                },
                                "orderFrom": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "orderTo": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              },
                              "additionalProperties": false
                            },
                            "affectedQuestionIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "identical": {
                              "type": "boolean"
                            }
                          },
                          "additionalProperties": false,
                          "description": "Structural diff of exactly this patch (draft before → draft after), the same shape opentrain_diff_quiz returns."
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "target",
                        "form",
                        "contentHash",
                        "replayed"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "form_import"
                          ]
                        },
                        "target": {
                          "type": "string",
                          "enum": [
                            "CREATE",
                            "UPDATE_DRAFT"
                          ]
                        },
                        "form": {
                          "type": "object",
                          "required": [
                            "id",
                            "title",
                            "description",
                            "scopeJobId",
                            "draftRevision",
                            "archivedAt",
                            "updatedAt",
                            "latestVersion"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "scopeJobId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "null = organization template."
                            },
                            "draftRevision": {
                              "type": "integer"
                            },
                            "archivedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "latestVersion": {
                              "oneOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "id",
                                    "versionNumber",
                                    "publishedAt",
                                    "contentHash"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "versionNumber": {
                                      "type": "integer"
                                    },
                                    "publishedAt": {
                                      "type": "string",
                                      "format": "date-time"
                                    },
                                    "contentHash": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "contentHash": {
                          "type": "string",
                          "description": "The PORTABLE content hash: hashNativeFormPublication over the document’s content (settings without the server-owned authoringDecision, the definition as stored). It identifies portable content across export → edit → import; it is NOT the hash a publication records (publishing prunes uncited grounding pins and refreshes the tree checksum, and a stored authoringDecision is part of the recorded settings) — see recordedContentHash."
                        },
                        "replayed": {
                          "type": "boolean",
                          "description": "True when the receipt replayed a stored response OR the committed create was recovered by key."
                        },
                        "learningPlan": {
                          "type": "object",
                          "properties": {
                            "required": {
                              "type": "boolean",
                              "const": false
                            },
                            "missing": {
                              "type": "boolean",
                              "const": true
                            },
                            "next": {
                              "type": "string",
                              "const": "lms.authoring.plan"
                            }
                          },
                          "required": [
                            "required",
                            "missing",
                            "next"
                          ],
                          "additionalProperties": false,
                          "description": "CREATE only, present when no confirmed plan was supplied (as on form_create)."
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "sourceFormId",
                        "source",
                        "draftRevision",
                        "formVersionId",
                        "versionNumber",
                        "contentHash",
                        "recordedContentHash",
                        "groundingDetached",
                        "template",
                        "replayed"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "template_create_from_form"
                          ]
                        },
                        "sourceFormId": {
                          "type": "string"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "VERSION"
                          ]
                        },
                        "draftRevision": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "formVersionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "versionNumber": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "contentHash": {
                          "type": "string",
                          "description": "The PORTABLE content hash: hashNativeFormPublication over the document’s content (settings without the server-owned authoringDecision, the definition as stored). It identifies portable content across export → edit → import; it is NOT the hash a publication records (publishing prunes uncited grounding pins and refreshes the tree checksum, and a stored authoringDecision is part of the recorded settings) — see recordedContentHash."
                        },
                        "recordedContentHash": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The hash the publication recorded (VERSION sources); null for a draft."
                        },
                        "groundingDetached": {
                          "type": "boolean",
                          "description": "True when the template was created from the portable projection of a grounded source."
                        },
                        "template": {
                          "type": "object",
                          "required": [
                            "id",
                            "title",
                            "description",
                            "scopeJobId",
                            "draftRevision",
                            "archivedAt",
                            "updatedAt",
                            "latestVersion"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "scopeJobId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "null = organization template."
                            },
                            "draftRevision": {
                              "type": "integer"
                            },
                            "archivedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "latestVersion": {
                              "oneOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "id",
                                    "versionNumber",
                                    "publishedAt",
                                    "contentHash"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "versionNumber": {
                                      "type": "integer"
                                    },
                                    "publishedAt": {
                                      "type": "string",
                                      "format": "date-time"
                                    },
                                    "contentHash": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "templateId",
                        "templateRevision",
                        "jobId",
                        "form",
                        "contentHash",
                        "replayed"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "template_instantiate"
                          ]
                        },
                        "templateId": {
                          "type": "string"
                        },
                        "templateRevision": {
                          "type": "integer"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "form": {
                          "type": "object",
                          "required": [
                            "id",
                            "title",
                            "description",
                            "scopeJobId",
                            "draftRevision",
                            "archivedAt",
                            "updatedAt",
                            "latestVersion"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "scopeJobId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "null = organization template."
                            },
                            "draftRevision": {
                              "type": "integer"
                            },
                            "archivedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "latestVersion": {
                              "oneOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "id",
                                    "versionNumber",
                                    "publishedAt",
                                    "contentHash"
                                  ],
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "versionNumber": {
                                      "type": "integer"
                                    },
                                    "publishedAt": {
                                      "type": "string",
                                      "format": "date-time"
                                    },
                                    "contentHash": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "contentHash": {
                          "type": "string"
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "publishable",
                        "blockers",
                        "warnings",
                        "job",
                        "form",
                        "publication",
                        "todo",
                        "audience",
                        "duplicates",
                        "notifications",
                        "plan",
                        "nextAction"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "quiz_rollout_plan"
                          ]
                        },
                        "publishable": {
                          "type": "boolean"
                        },
                        "blockers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "code",
                              "message"
                            ],
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "PROJECT_TODOS_DISABLED",
                                  "FORM_ARCHIVED",
                                  "DRAFT_REVISION_STALE",
                                  "DRAFT_INVALID",
                                  "NOT_PUBLISHABLE",
                                  "ASSET_UNUSABLE",
                                  "SOURCE_CHANGED",
                                  "GROUNDING_DRAFT_PREVIEW",
                                  "LEARNING_PLAN_MISMATCH",
                                  "ON_PASS_REQUIRES_PASS_RULE",
                                  "ON_PASS_REQUIRES_AUTO_GRADING"
                                ]
                              },
                              "message": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "job": {
                          "type": "object",
                          "required": [
                            "id",
                            "title",
                            "projectTodosEnabled"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "title": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "projectTodosEnabled": {
                              "type": "boolean"
                            }
                          },
                          "additionalProperties": false
                        },
                        "form": {
                          "type": "object",
                          "required": [
                            "formId",
                            "title",
                            "archived",
                            "source",
                            "draftRevision",
                            "formVersionId",
                            "versionNumber",
                            "nextVersionNumber",
                            "contentHash"
                          ],
                          "properties": {
                            "formId": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "archived": {
                              "type": "boolean"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "DRAFT",
                                "VERSION"
                              ]
                            },
                            "draftRevision": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "formVersionId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "versionNumber": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "nextVersionNumber": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "contentHash": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        },
                        "publication": {
                          "type": "object",
                          "required": [
                            "totalPoints",
                            "answerableQuestionCount",
                            "manualQuestionCount",
                            "passRule",
                            "attemptPolicy",
                            "resultRelease"
                          ],
                          "properties": {
                            "totalPoints": {
                              "type": "integer"
                            },
                            "answerableQuestionCount": {
                              "type": "integer"
                            },
                            "manualQuestionCount": {
                              "type": "integer"
                            },
                            "passRule": {
                              "oneOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "mode",
                                    "thresholdPercent"
                                  ],
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "enum": [
                                        "PERCENTAGE"
                                      ]
                                    },
                                    "thresholdPercent": {
                                      "type": "integer"
                                    }
                                  },
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "mode",
                                    "thresholdPoints"
                                  ],
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "enum": [
                                        "ABSOLUTE"
                                      ]
                                    },
                                    "thresholdPoints": {
                                      "type": "integer"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "attemptPolicy": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "required": [
                                    "mode"
                                  ],
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "enum": [
                                        "UNLIMITED"
                                      ]
                                    }
                                  },
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "required": [
                                    "mode",
                                    "maxAttempts"
                                  ],
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "enum": [
                                        "LIMITED"
                                      ]
                                    },
                                    "maxAttempts": {
                                      "type": "integer"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "resultRelease": {
                              "type": "string",
                              "enum": [
                                "IMMEDIATE",
                                "MANUAL"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "todo": {
                          "type": "object",
                          "required": [
                            "categoryId",
                            "completionPolicy",
                            "title",
                            "description",
                            "required",
                            "priority",
                            "blockingMode",
                            "blockingScope",
                            "dueOffsetMinutes",
                            "projectedDueAt",
                            "projectedBlockAt"
                          ],
                          "properties": {
                            "categoryId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "completionPolicy": {
                              "type": "string",
                              "enum": [
                                "ON_SUBMIT",
                                "ON_PASS",
                                "ON_REVIEW"
                              ]
                            },
                            "title": {
                              "type": "string"
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "required": {
                              "type": "boolean"
                            },
                            "priority": {
                              "type": "string",
                              "enum": [
                                "NORMAL",
                                "HIGH",
                                "URGENT"
                              ]
                            },
                            "blockingMode": {
                              "type": "string",
                              "enum": [
                                "NONE",
                                "IMMEDIATE",
                                "AFTER_DUE"
                              ]
                            },
                            "blockingScope": {
                              "type": "string",
                              "enum": [
                                "PROJECT_WORK"
                              ]
                            },
                            "dueOffsetMinutes": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "projectedDueAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "projectedBlockAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          },
                          "additionalProperties": false
                        },
                        "audience": {
                          "type": "object",
                          "required": [
                            "audience",
                            "broadAudience",
                            "includesFutureHires",
                            "currentRecipientCount",
                            "recipients"
                          ],
                          "properties": {
                            "audience": {
                              "type": "string",
                              "enum": [
                                "ACTIVE",
                                "FUTURE",
                                "ACTIVE_AND_FUTURE",
                                "SELECTED"
                              ]
                            },
                            "broadAudience": {
                              "type": "boolean"
                            },
                            "includesFutureHires": {
                              "type": "boolean"
                            },
                            "currentRecipientCount": {
                              "type": "integer"
                            },
                            "recipients": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "contractId",
                                  "displayName"
                                ],
                                "properties": {
                                  "contractId": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string",
                                    "description": "Masked (\"First L.\"); never an e-mail."
                                  }
                                },
                                "additionalProperties": false
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "duplicates": {
                          "type": "object",
                          "required": [
                            "sameForm",
                            "sameFormVersion"
                          ],
                          "properties": {
                            "sameForm": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "itemId",
                                  "key",
                                  "title"
                                ],
                                "properties": {
                                  "itemId": {
                                    "type": "string"
                                  },
                                  "key": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "sameFormVersion": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "itemId",
                                  "key",
                                  "title"
                                ],
                                "properties": {
                                  "itemId": {
                                    "type": "string"
                                  },
                                  "key": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "notifications": {
                          "type": "object",
                          "required": [
                            "assignmentNotifications",
                            "futureHireAutoAssign",
                            "workerVisibleImmediately",
                            "blocksProjectWork"
                          ],
                          "properties": {
                            "assignmentNotifications": {
                              "type": "integer"
                            },
                            "futureHireAutoAssign": {
                              "type": "boolean"
                            },
                            "workerVisibleImmediately": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "blocksProjectWork": {
                              "type": "boolean"
                            }
                          },
                          "additionalProperties": false
                        },
                        "plan": {
                          "oneOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "object",
                              "required": [
                                "token",
                                "expiresAt"
                              ],
                              "properties": {
                                "token": {
                                  "type": "string"
                                },
                                "expiresAt": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              },
                              "additionalProperties": false
                            }
                          ],
                          "description": "Present only when publishable; expires after 15 minutes."
                        },
                        "nextAction": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "action",
                        "ok",
                        "published",
                        "todo",
                        "audience",
                        "includesFutureHires",
                        "fanOut",
                        "warnings",
                        "replayed"
                      ],
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "quiz_rollout_confirm"
                          ]
                        },
                        "ok": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "published": {
                          "type": "object",
                          "required": [
                            "formId",
                            "formVersionId",
                            "versionNumber",
                            "createdNow",
                            "resumed"
                          ],
                          "properties": {
                            "formId": {
                              "type": "string"
                            },
                            "formVersionId": {
                              "type": "string"
                            },
                            "versionNumber": {
                              "type": "integer"
                            },
                            "createdNow": {
                              "type": "boolean",
                              "description": "True when THIS confirm published the version (false: planned VERSION or resumed)."
                            },
                            "resumed": {
                              "type": "boolean",
                              "description": "True when this rollout had published the version on an earlier attempt and this confirm resumed it (false: published now, or a planned VERSION that was only bound)."
                            }
                          },
                          "additionalProperties": false
                        },
                        "todo": {
                          "type": "object",
                          "required": [
                            "itemId",
                            "versionId",
                            "replayed"
                          ],
                          "properties": {
                            "itemId": {
                              "type": "string"
                            },
                            "versionId": {
                              "type": "string"
                            },
                            "replayed": {
                              "type": "boolean"
                            }
                          },
                          "additionalProperties": false
                        },
                        "audience": {
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "FUTURE",
                            "ACTIVE_AND_FUTURE",
                            "SELECTED"
                          ]
                        },
                        "includesFutureHires": {
                          "type": "boolean"
                        },
                        "fanOut": {
                          "type": "object",
                          "required": [
                            "matchedContracts",
                            "createdAssignments",
                            "skippedExistingAssignments",
                            "failedAssignments"
                          ],
                          "properties": {
                            "matchedContracts": {
                              "type": "integer"
                            },
                            "createdAssignments": {
                              "type": "integer"
                            },
                            "skippedExistingAssignments": {
                              "type": "integer"
                            },
                            "failedAssignments": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "$ref": "#/components/schemas/ProjectTodoQuizCoachingManageResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid action payload, ceiling violation, or ineligible release",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or surface disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job, form, template, version, attempt, or assignment not found (incl. binding mismatch; another organization's job and a missing job are one indistinguishable 404)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale review, revision conflict, key reuse (incl. a create/import key reused with a different document), PLAN_STALE (incl. rollout drift: details.changed, details.published), PLAN_TOKEN_INVALID / PLAN_TOKEN_EXPIRED / PLAN_TODO_MISMATCH / TARGET_ALREADY_MUTATED (rollout), OPEN_THREADS_REQUIRE_ACK, or SOURCE_CHANGED (publish: `details.affectedQuestionIds` + `details.findings`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching-queue": {
      "get": {
        "operationId": "projectTodoQuizCoachingQueue",
        "tags": [
          "project-todos"
        ],
        "summary": "List submitted quiz to-dos waiting on employer coaching (keyset-paged)",
        "description": "Requires `project_todos:read`, the default-off project-todos agent surface, a claimed employer account, and access to the explicit job. Rows carry masked worker names, the latest submitted attempt, and at most 3 live coaching cycles with a `liveCyclesTruncated` conflict signal. Response `view: \"queue\"` discriminates the coaching read union. DEVICE tokens are rejected.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Exact contract (worker) filter — an ID, never a name."
          },
          {
            "name": "formId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formVersionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "submittedAfter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "submittedBefore",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Must be on or after submittedAfter (400 otherwise)."
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "FIRST_REVIEW",
                "COACHING_DRAFT",
                "COACHING_RESUBMITTED"
              ]
            },
            "description": "Live-cycle-derived review/coaching state: FIRST_REVIEW = no live cycle, COACHING_DRAFT = a private DRAFT selection exists, COACHING_RESUBMITTED = a coaching revision awaits re-review."
          }
        ],
        "responses": {
          "200": {
            "description": "Coaching queue page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "view",
                    "jobId",
                    "filters",
                    "queue",
                    "nextCursor"
                  ],
                  "properties": {
                    "view": {
                      "type": "string",
                      "enum": [
                        "queue"
                      ]
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "description": "Applied-filter echo (C4.5) — the deterministic page contract restated.",
                      "required": [
                        "contractId",
                        "formId",
                        "formVersionId",
                        "submittedAfter",
                        "submittedBefore",
                        "state"
                      ],
                      "properties": {
                        "contractId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "formId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "formVersionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "submittedAfter": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "submittedBefore": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "state": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "FIRST_REVIEW",
                            "COACHING_DRAFT",
                            "COACHING_RESUBMITTED",
                            null
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "queue": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "assignmentId",
                          "contractId",
                          "submittedAt",
                          "workerDisplayName",
                          "itemTitle",
                          "latestSubmitted",
                          "liveCycles",
                          "liveCyclesTruncated"
                        ],
                        "properties": {
                          "assignmentId": {
                            "type": "string"
                          },
                          "contractId": {
                            "type": "string"
                          },
                          "submittedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "workerDisplayName": {
                            "type": "string",
                            "description": "Masked person name."
                          },
                          "itemTitle": {
                            "type": "string"
                          },
                          "latestSubmitted": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "required": [
                              "attemptId",
                              "submittedAt",
                              "attemptKind"
                            ],
                            "properties": {
                              "attemptId": {
                                "type": "string"
                              },
                              "submittedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "attemptKind": {
                                "type": "string",
                                "enum": [
                                  "REMEDIATION",
                                  "FULL"
                                ]
                              }
                            },
                            "additionalProperties": false
                          },
                          "liveCycles": {
                            "type": "array",
                            "maxItems": 3,
                            "items": {
                              "type": "object",
                              "required": [
                                "reviewCycleId",
                                "status"
                              ],
                              "properties": {
                                "reviewCycleId": {
                                  "type": "string"
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "DRAFT",
                                    "OPEN",
                                    "RESUBMITTED",
                                    "CLOSED"
                                  ]
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "liveCyclesTruncated": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/capabilities": {
      "get": {
        "operationId": "projectTodoQuizCoachingCapabilities",
        "tags": [
          "project-todos"
        ],
        "summary": "UNGATED coaching capability discovery (static facts only)",
        "description": "Requires only a non-DEVICE token with `project_todos:read` — deliberately NO agent-surface flag, NO claimed-account gate, NO job — so an agent can discover the full coaching contract BEFORE the surface is enabled. Operations/scopes/status derive from the shared agent-operations registry; limits, enums, rich-doc and MIME vocabulary, the direct-upload workflow, the nine lifecycle event kinds, the closed typed-error vocabulary, and export formats derive from the exact modules the platform enforces, so contract and validators cannot drift.",
        "responses": {
          "200": {
            "description": "Coaching capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "UNGATED static discovery facts (C4.4): requires only a non-DEVICE token with project_todos:read — no agent-surface flag, no claimed account, no job. Operations/scopes/status derive from the shared agent-operations registry; limits, enums, rich-doc vocabulary, image workflow, event kinds, closed error vocabulary, and export formats derive from the exact validator/contract modules the platform enforces.",
                  "required": [
                    "family",
                    "operations",
                    "limits",
                    "enums",
                    "richDocNodes",
                    "richDocMarks",
                    "linkSafety",
                    "events",
                    "errors",
                    "exports"
                  ],
                  "properties": {
                    "family": {
                      "type": "string",
                      "enum": [
                        "project_todos.quizzes.coaching"
                      ]
                    },
                    "operations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "kind",
                          "scopes",
                          "idempotency",
                          "status"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "read",
                              "mutation",
                              "preflight"
                            ]
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "idempotency": {
                            "type": "string",
                            "enum": [
                              "not-required",
                              "client-key-required",
                              "client-key-for-writes"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "planned",
                              "available"
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "required": [
                        "page",
                        "exportPage",
                        "queueLiveCyclePreview",
                        "redoSelectionMaxQuestions",
                        "reasonMaxLength",
                        "retakeRowsMax",
                        "employerIdempotencyKey",
                        "workerReceiptIdempotencyKey",
                        "workerOperationKey",
                        "planToken",
                        "richDoc",
                        "image",
                        "rateLimits"
                      ],
                      "properties": {
                        "page": {
                          "type": "object",
                          "required": [
                            "min",
                            "max",
                            "default"
                          ],
                          "properties": {
                            "min": {
                              "type": "integer"
                            },
                            "max": {
                              "type": "integer"
                            },
                            "default": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "exportPage": {
                          "type": "object",
                          "required": [
                            "min",
                            "max",
                            "default"
                          ],
                          "properties": {
                            "min": {
                              "type": "integer"
                            },
                            "max": {
                              "type": "integer"
                            },
                            "default": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "queueLiveCyclePreview": {
                          "type": "integer"
                        },
                        "redoSelectionMaxQuestions": {
                          "type": "integer"
                        },
                        "reasonMaxLength": {
                          "type": "integer"
                        },
                        "retakeRowsMax": {
                          "type": "integer"
                        },
                        "employerIdempotencyKey": {
                          "type": "object",
                          "required": [
                            "minLength",
                            "maxLength",
                            "pattern"
                          ],
                          "properties": {
                            "minLength": {
                              "type": "integer"
                            },
                            "maxLength": {
                              "type": "integer"
                            },
                            "pattern": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        },
                        "workerReceiptIdempotencyKey": {
                          "type": "object",
                          "required": [
                            "minLength",
                            "maxLength",
                            "pattern"
                          ],
                          "properties": {
                            "minLength": {
                              "type": "integer"
                            },
                            "maxLength": {
                              "type": "integer"
                            },
                            "pattern": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        },
                        "workerOperationKey": {
                          "type": "object",
                          "required": [
                            "minLength",
                            "maxLength"
                          ],
                          "properties": {
                            "minLength": {
                              "type": "integer"
                            },
                            "maxLength": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "planToken": {
                          "type": "object",
                          "required": [
                            "minLength",
                            "maxLength",
                            "ttlMs"
                          ],
                          "properties": {
                            "minLength": {
                              "type": "integer"
                            },
                            "maxLength": {
                              "type": "integer"
                            },
                            "ttlMs": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "richDoc": {
                          "type": "object",
                          "required": [
                            "maxBytes",
                            "maxDepth",
                            "maxImages",
                            "plainTextMaxLength",
                            "linkMaxLength",
                            "imageAltMaxLength"
                          ],
                          "properties": {
                            "maxBytes": {
                              "type": "integer"
                            },
                            "maxDepth": {
                              "type": "integer"
                            },
                            "maxImages": {
                              "type": "integer"
                            },
                            "plainTextMaxLength": {
                              "type": "integer"
                            },
                            "linkMaxLength": {
                              "type": "integer"
                            },
                            "imageAltMaxLength": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "image": {
                          "type": "object",
                          "required": [
                            "maxBytes",
                            "maxDimensionPx",
                            "maxPixels",
                            "mimeTypes",
                            "directUpload"
                          ],
                          "properties": {
                            "maxBytes": {
                              "type": "integer"
                            },
                            "maxDimensionPx": {
                              "type": "integer"
                            },
                            "maxPixels": {
                              "type": "integer"
                            },
                            "mimeTypes": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp",
                                  "image/gif"
                                ]
                              }
                            },
                            "directUpload": {
                              "type": "object",
                              "required": [
                                "transport",
                                "upsert",
                                "uploadGrantTtlSeconds",
                                "deliveryGrantTtlSeconds",
                                "operations"
                              ],
                              "properties": {
                                "transport": {
                                  "type": "string",
                                  "enum": [
                                    "signed_put"
                                  ]
                                },
                                "upsert": {
                                  "type": "boolean",
                                  "enum": [
                                    false
                                  ]
                                },
                                "uploadGrantTtlSeconds": {
                                  "type": "integer"
                                },
                                "deliveryGrantTtlSeconds": {
                                  "type": "integer"
                                },
                                "operations": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "enum": [
                                      "prepare",
                                      "finalize",
                                      "status",
                                      "delivery"
                                    ]
                                  }
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "rateLimits": {
                          "type": "object",
                          "required": [
                            "read",
                            "write",
                            "upload",
                            "export"
                          ],
                          "properties": {
                            "read": {
                              "type": "object",
                              "required": [
                                "limit",
                                "windowSeconds"
                              ],
                              "properties": {
                                "limit": {
                                  "type": "integer"
                                },
                                "windowSeconds": {
                                  "type": "integer"
                                }
                              },
                              "additionalProperties": false
                            },
                            "write": {
                              "type": "object",
                              "required": [
                                "limit",
                                "windowSeconds"
                              ],
                              "properties": {
                                "limit": {
                                  "type": "integer"
                                },
                                "windowSeconds": {
                                  "type": "integer"
                                }
                              },
                              "additionalProperties": false
                            },
                            "upload": {
                              "type": "object",
                              "required": [
                                "limit",
                                "windowSeconds"
                              ],
                              "properties": {
                                "limit": {
                                  "type": "integer"
                                },
                                "windowSeconds": {
                                  "type": "integer"
                                }
                              },
                              "additionalProperties": false
                            },
                            "export": {
                              "type": "object",
                              "required": [
                                "limit",
                                "windowSeconds"
                              ],
                              "properties": {
                                "limit": {
                                  "type": "integer"
                                },
                                "windowSeconds": {
                                  "type": "integer"
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "enums": {
                      "type": "object",
                      "required": [
                        "cycleStatuses",
                        "cycleClosedReasons",
                        "threadStatuses",
                        "commentAuthorRoles",
                        "commentVisibilities",
                        "attemptKinds",
                        "queueStates",
                        "runnerStates"
                      ],
                      "properties": {
                        "cycleStatuses": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "OPEN",
                              "RESUBMITTED",
                              "CLOSED"
                            ]
                          }
                        },
                        "cycleClosedReasons": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "ACCEPTED",
                              "GRADED",
                              "SUPERSEDED",
                              "CANCELLED"
                            ]
                          }
                        },
                        "threadStatuses": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "RESOLVED"
                            ]
                          }
                        },
                        "commentAuthorRoles": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "EMPLOYER",
                              "WORKER"
                            ]
                          }
                        },
                        "commentVisibilities": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "WORKER_VISIBLE",
                              "EMPLOYER_DRAFT",
                              "ERASED"
                            ]
                          }
                        },
                        "attemptKinds": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "FULL",
                              "REMEDIATION"
                            ]
                          }
                        },
                        "queueStates": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "FIRST_REVIEW",
                              "COACHING_DRAFT",
                              "COACHING_RESUBMITTED"
                            ]
                          }
                        },
                        "runnerStates": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "START_AVAILABLE",
                              "NOT_AVAILABLE"
                            ]
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "richDocNodes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "doc",
                          "paragraph",
                          "heading",
                          "codeBlock",
                          "text",
                          "hardBreak",
                          "image",
                          "bulletList",
                          "orderedList",
                          "listItem"
                        ]
                      }
                    },
                    "richDocMarks": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "bold",
                          "italic",
                          "underline",
                          "code",
                          "link"
                        ]
                      }
                    },
                    "linkSafety": {
                      "type": "object",
                      "required": [
                        "protocols",
                        "maxLength"
                      ],
                      "properties": {
                        "protocols": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "http:",
                              "https:"
                            ]
                          }
                        },
                        "maxLength": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": false
                    },
                    "events": {
                      "type": "object",
                      "required": [
                        "scope",
                        "types"
                      ],
                      "properties": {
                        "scope": {
                          "type": "string",
                          "enum": [
                            "project_todos:read"
                          ]
                        },
                        "types": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "project_todo.quiz.coaching.cycle_sent",
                              "project_todo.quiz.coaching.comment_published",
                              "project_todo.quiz.coaching.reply_created",
                              "project_todo.quiz.coaching.thread_resolved",
                              "project_todo.quiz.coaching.thread_reopened",
                              "project_todo.quiz.coaching.resubmitted",
                              "project_todo.quiz.coaching.accepted",
                              "project_todo.quiz.coaching.cycle_superseded",
                              "project_todo.quiz.full_retake_returned"
                            ]
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "errors": {
                      "type": "object",
                      "description": "reason → { retryable, nextAction } — the closed typed-error vocabulary.",
                      "required": [
                        "PLAN_STALE",
                        "PLAN_TOKEN_REQUIRED",
                        "PLAN_TOKEN_INVALID",
                        "PLAN_TOKEN_EXPIRED",
                        "CYCLE_NOT_DRAFT",
                        "STALE_SUBMISSION",
                        "ATTEMPT_IN_PROGRESS",
                        "EMPTY_REDO_SELECTION",
                        "INVALID_QUESTION_ID",
                        "UNGRADED_KEPT_QUESTIONS",
                        "THREAD_RESOLVED",
                        "CYCLE_CLOSED",
                        "ANSWER_NOT_REQUESTED",
                        "IDEMPOTENCY_CONFLICT",
                        "ATTEMPT_NOT_REVIEWABLE",
                        "OPEN_THREADS_REQUIRE_ACK",
                        "NOT_FOUND",
                        "REVISION_CONFLICT",
                        "IMAGE_INVALID",
                        "UPLOAD_INCOMPLETE",
                        "UPLOAD_VERIFICATION_FAILED",
                        "CHECKSUM_MISMATCH",
                        "RATE_LIMITED"
                      ],
                      "properties": {
                        "PLAN_STALE": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "PLAN_TOKEN_REQUIRED": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "PLAN_TOKEN_INVALID": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "PLAN_TOKEN_EXPIRED": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "CYCLE_NOT_DRAFT": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "STALE_SUBMISSION": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "ATTEMPT_IN_PROGRESS": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "EMPTY_REDO_SELECTION": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "INVALID_QUESTION_ID": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "UNGRADED_KEPT_QUESTIONS": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "THREAD_RESOLVED": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "CYCLE_CLOSED": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "ANSWER_NOT_REQUESTED": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "IDEMPOTENCY_CONFLICT": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "ATTEMPT_NOT_REVIEWABLE": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "OPEN_THREADS_REQUIRE_ACK": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "NOT_FOUND": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "REVISION_CONFLICT": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "IMAGE_INVALID": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "UPLOAD_INCOMPLETE": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "UPLOAD_VERIFICATION_FAILED": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "CHECKSUM_MISMATCH": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "RATE_LIMITED": {
                          "type": "object",
                          "required": [
                            "retryable",
                            "nextAction"
                          ],
                          "properties": {
                            "retryable": {
                              "type": "boolean"
                            },
                            "nextAction": {
                              "type": "string",
                              "enum": [
                                "RERUN_PLAN",
                                "READ_STATE",
                                "WAIT_FOR_RESUBMIT",
                                "FIX_REQUEST",
                                "GRADE_KEPT_QUESTIONS",
                                "USE_FRESH_KEY",
                                "UPLOAD_NEW_IMAGE",
                                "COMPLETE_UPLOAD",
                                "RETRY_FINALIZE",
                                "RETRY_AFTER_DELAY"
                              ]
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "exports": {
                      "type": "object",
                      "required": [
                        "kinds",
                        "formats",
                        "richDocFormats",
                        "csv",
                        "identity",
                        "redactions"
                      ],
                      "properties": {
                        "kinds": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "assignments",
                              "cycles",
                              "threads",
                              "comments",
                              "transitions",
                              "audit"
                            ]
                          }
                        },
                        "formats": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "json",
                              "jsonl",
                              "csv"
                            ]
                          }
                        },
                        "richDocFormats": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "json",
                              "jsonl"
                            ]
                          }
                        },
                        "csv": {
                          "type": "object",
                          "required": [
                            "formulaNeutral",
                            "richDocsExcluded"
                          ],
                          "properties": {
                            "formulaNeutral": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "richDocsExcluded": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "identity": {
                          "type": "string",
                          "enum": [
                            "MASKED"
                          ]
                        },
                        "redactions": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "worker_email",
                              "worker_full_name",
                              "answer_keys"
                            ]
                          }
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or device token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/export": {
      "get": {
        "operationId": "projectTodoQuizCoachingExport",
        "tags": [
          "project-todos"
        ],
        "summary": "Bounded employer coaching export (JSON / JSONL / formula-neutral CSV)",
        "description": "Requires `project_todos:read`, the project-todos agent surface, a claimed employer account, and job access (its own `export` rate lane). Keyset pages of stable record kinds — assignments, cycles, threads, comments, transitions, audit — with MASKED worker identity, never emails or answer keys. Rich docs (comment bodies) and recursively sanitized transition/audit metadata ride JSON/JSONL ONLY; the CSV projection is scalar columns through the spreadsheet-formula-neutralizing writer. `kind=audit` requires `assignmentId` and pages a SCAN_WINDOW over the form audit log with page-candidate membership only (a page may hold zero relevant records while the scan cursor advances).",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "assignments",
                "cycles",
                "threads",
                "comments",
                "transitions",
                "audit"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "jsonl",
                "csv"
              ],
              "default": "json"
            }
          },
          {
            "name": "assignmentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Narrow to one assignment (REQUIRED for kind=audit)."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Export page",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "view",
                        "kind",
                        "format",
                        "jobId",
                        "assignmentId",
                        "asOf",
                        "recordCount",
                        "nextCursor",
                        "cursorKind",
                        "redactions",
                        "records"
                      ],
                      "properties": {
                        "view": {
                          "type": "string",
                          "enum": [
                            "export"
                          ]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "assignments",
                            "cycles",
                            "threads",
                            "comments",
                            "transitions",
                            "audit"
                          ]
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "asOf": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "recordCount": {
                          "type": "integer"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "cursorKind": {
                          "type": "string",
                          "enum": [
                            "RECORD",
                            "SCAN_WINDOW"
                          ],
                          "description": "RECORD: nextCursor is the last returned record. SCAN_WINDOW (audit): nextCursor is the last SCANNED form-log row — a page may hold zero relevant records while the cursor still advances."
                        },
                        "scannedCount": {
                          "type": "integer",
                          "description": "Audit kind only: rows examined for this page (matched ⊆ scanned)."
                        },
                        "redactions": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "worker_email",
                              "worker_full_name",
                              "answer_keys"
                            ]
                          }
                        },
                        "format": {
                          "type": "string",
                          "enum": [
                            "json"
                          ]
                        },
                        "records": {
                          "type": "array",
                          "description": "Stable per-kind record shapes with masked identity; rich docs and recursively sanitized metadata are available only in JSON and JSONL.",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "required": [
                                  "record",
                                  "assignmentId",
                                  "contractId",
                                  "workerLabel",
                                  "itemTitle",
                                  "status",
                                  "waitingOnRole",
                                  "assignedAt",
                                  "submittedAt",
                                  "completedAt",
                                  "dueAt",
                                  "formVersionId",
                                  "completionPolicy"
                                ],
                                "properties": {
                                  "record": {
                                    "type": "string",
                                    "enum": [
                                      "assignment"
                                    ]
                                  },
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "contractId": {
                                    "type": "string"
                                  },
                                  "workerLabel": {
                                    "type": "string",
                                    "description": "Masked person name."
                                  },
                                  "itemTitle": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "OPEN",
                                      "IN_PROGRESS",
                                      "SUBMITTED",
                                      "COMPLETED",
                                      "RETURNED",
                                      "WAIVED",
                                      "CLOSED",
                                      "SUPERSEDED"
                                    ]
                                  },
                                  "waitingOnRole": {
                                    "type": "string",
                                    "enum": [
                                      "WORKER",
                                      "EMPLOYER",
                                      "NONE"
                                    ]
                                  },
                                  "assignedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "submittedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "completedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "dueAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "formVersionId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "completionPolicy": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "ON_SUBMIT",
                                      "ON_PASS",
                                      "ON_REVIEW",
                                      null
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "record",
                                  "reviewCycleId",
                                  "assignmentId",
                                  "cycleNumber",
                                  "status",
                                  "sourceAttemptId",
                                  "requestedQuestionIds",
                                  "requestedQuestionCount",
                                  "reason",
                                  "createdAt",
                                  "sentAt",
                                  "closedAt",
                                  "closedReason"
                                ],
                                "properties": {
                                  "record": {
                                    "type": "string",
                                    "enum": [
                                      "cycle"
                                    ]
                                  },
                                  "reviewCycleId": {
                                    "type": "string"
                                  },
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "cycleNumber": {
                                    "type": "integer"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "DRAFT",
                                      "OPEN",
                                      "RESUBMITTED",
                                      "CLOSED"
                                    ]
                                  },
                                  "sourceAttemptId": {
                                    "type": "string"
                                  },
                                  "requestedQuestionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "requestedQuestionCount": {
                                    "type": "integer"
                                  },
                                  "reason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "sentAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "closedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "closedReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "ACCEPTED",
                                      "GRADED",
                                      "SUPERSEDED",
                                      "CANCELLED",
                                      null
                                    ]
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "record",
                                  "threadId",
                                  "assignmentId",
                                  "questionId",
                                  "status",
                                  "createdAt",
                                  "lastActivityAt",
                                  "resolvedAt"
                                ],
                                "properties": {
                                  "record": {
                                    "type": "string",
                                    "enum": [
                                      "thread"
                                    ]
                                  },
                                  "threadId": {
                                    "type": "string"
                                  },
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "questionId": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "OPEN",
                                      "RESOLVED"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "lastActivityAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "resolvedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "record",
                                  "commentId",
                                  "threadId",
                                  "assignmentId",
                                  "questionId",
                                  "reviewCycleId",
                                  "authorRole",
                                  "workerVisible",
                                  "createdAt"
                                ],
                                "properties": {
                                  "record": {
                                    "type": "string",
                                    "enum": [
                                      "comment"
                                    ]
                                  },
                                  "commentId": {
                                    "type": "string"
                                  },
                                  "threadId": {
                                    "type": "string"
                                  },
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "questionId": {
                                    "type": "string"
                                  },
                                  "reviewCycleId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "authorRole": {
                                    "type": "string",
                                    "enum": [
                                      "EMPLOYER",
                                      "WORKER"
                                    ]
                                  },
                                  "workerVisible": {
                                    "type": "boolean"
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "bodyDoc": {
                                    "$ref": "#/components/schemas/ProjectTodoJsonValue",
                                    "description": "JSON/JSONL formats only — never CSV."
                                  },
                                  "bodyText": {
                                    "type": "string",
                                    "description": "JSON/JSONL formats only — never CSV."
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "record",
                                  "eventId",
                                  "assignmentId",
                                  "eventType",
                                  "previousStatus",
                                  "nextStatus",
                                  "reason",
                                  "createdAt"
                                ],
                                "properties": {
                                  "record": {
                                    "type": "string",
                                    "enum": [
                                      "transition"
                                    ]
                                  },
                                  "eventId": {
                                    "type": "string"
                                  },
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "eventType": {
                                    "type": "string"
                                  },
                                  "previousStatus": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "nextStatus": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "reason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "metadata": {
                                    "$ref": "#/components/schemas/ProjectTodoJsonValue",
                                    "description": "JSON/JSONL only; recursively sanitized (answer/correct/grading/scoring/email keys dropped at every depth)."
                                  },
                                  "metadataRedactedKeyCount": {
                                    "type": "integer"
                                  }
                                },
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "required": [
                                  "record",
                                  "auditEventId",
                                  "eventType",
                                  "attemptId",
                                  "createdAt"
                                ],
                                "properties": {
                                  "record": {
                                    "type": "string",
                                    "enum": [
                                      "audit"
                                    ]
                                  },
                                  "auditEventId": {
                                    "type": "string"
                                  },
                                  "eventType": {
                                    "type": "string"
                                  },
                                  "attemptId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "metadata": {
                                    "$ref": "#/components/schemas/ProjectTodoJsonValue",
                                    "description": "JSON/JSONL only; recursively sanitized like transitions."
                                  },
                                  "metadataRedactedKeyCount": {
                                    "type": "integer"
                                  }
                                },
                                "additionalProperties": false
                              }
                            ],
                            "discriminator": {
                              "propertyName": "record"
                            }
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "view",
                        "kind",
                        "format",
                        "jobId",
                        "assignmentId",
                        "asOf",
                        "recordCount",
                        "nextCursor",
                        "cursorKind",
                        "redactions",
                        "jsonl"
                      ],
                      "properties": {
                        "view": {
                          "type": "string",
                          "enum": [
                            "export"
                          ]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "assignments",
                            "cycles",
                            "threads",
                            "comments",
                            "transitions",
                            "audit"
                          ]
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "asOf": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "recordCount": {
                          "type": "integer"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "cursorKind": {
                          "type": "string",
                          "enum": [
                            "RECORD",
                            "SCAN_WINDOW"
                          ],
                          "description": "RECORD: nextCursor is the last returned record. SCAN_WINDOW (audit): nextCursor is the last SCANNED form-log row — a page may hold zero relevant records while the cursor still advances."
                        },
                        "scannedCount": {
                          "type": "integer",
                          "description": "Audit kind only: rows examined for this page (matched ⊆ scanned)."
                        },
                        "redactions": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "worker_email",
                              "worker_full_name",
                              "answer_keys"
                            ]
                          }
                        },
                        "format": {
                          "type": "string",
                          "enum": [
                            "jsonl"
                          ]
                        },
                        "jsonl": {
                          "type": "string",
                          "description": "One JSON record per line."
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "required": [
                        "view",
                        "kind",
                        "format",
                        "jobId",
                        "assignmentId",
                        "asOf",
                        "recordCount",
                        "nextCursor",
                        "cursorKind",
                        "redactions",
                        "csv"
                      ],
                      "properties": {
                        "view": {
                          "type": "string",
                          "enum": [
                            "export"
                          ]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "assignments",
                            "cycles",
                            "threads",
                            "comments",
                            "transitions",
                            "audit"
                          ]
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "assignmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "asOf": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "recordCount": {
                          "type": "integer"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "cursorKind": {
                          "type": "string",
                          "enum": [
                            "RECORD",
                            "SCAN_WINDOW"
                          ],
                          "description": "RECORD: nextCursor is the last returned record. SCAN_WINDOW (audit): nextCursor is the last SCANNED form-log row — a page may hold zero relevant records while the cursor still advances."
                        },
                        "scannedCount": {
                          "type": "integer",
                          "description": "Audit kind only: rows examined for this page (matched ⊆ scanned)."
                        },
                        "redactions": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "worker_email",
                              "worker_full_name",
                              "answer_keys"
                            ]
                          }
                        },
                        "format": {
                          "type": "string",
                          "enum": [
                            "csv"
                          ]
                        },
                        "csv": {
                          "type": "string",
                          "description": "Scalar columns through the spreadsheet-formula-neutralizing writer; never bodies or metadata."
                        }
                      },
                      "additionalProperties": false
                    }
                  ],
                  "discriminator": {
                    "propertyName": "format"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid kind/format, inverted date range, or audit without assignmentId",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or assignment not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Export rate lane exhausted (typed RATE_LIMITED details)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}/assets/prepare": {
      "post": {
        "operationId": "projectTodoQuizCoachingAssetPrepare",
        "tags": [
          "project-todos"
        ],
        "summary": "Reserve a private feedback image and mint a signed single-PUT upload grant",
        "description": "Employer-only: requires `project_todos:write` plus organization/job access while the assignment is commentable. Receipt-idempotent under `Idempotency-Key` with a DETERMINISTIC reservation identity per (principal, key) — crash-takeover reruns converge on the same reservation and object path. The receipt persists ONLY the non-secret reservation; the short-lived path-scoped grant (provider-fixed 2h TTL, upsert DISABLED — verified READY bytes can never be overwritten) is minted fresh after (replay-)authorization on every call and never persisted. No request-body bytes, no base64. Served `Cache-Control: private, no-store`.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contentType",
                  "sizeBytes"
                ],
                "properties": {
                  "contentType": {
                    "type": "string",
                    "enum": [
                      "image/png",
                      "image/jpeg",
                      "image/webp",
                      "image/gif"
                    ]
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5242880
                  },
                  "questionId": {
                    "type": "string",
                    "description": "Optional quiz question binding for employer feedback."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Reservation + fresh upload grant",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asset",
                    "upload",
                    "replayed"
                  ],
                  "properties": {
                    "asset": {
                      "type": "object",
                      "required": [
                        "assetId",
                        "status",
                        "contentType",
                        "byteSize",
                        "widthPx",
                        "heightPx",
                        "sha256",
                        "uploaderRole",
                        "createdAt"
                      ],
                      "properties": {
                        "assetId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "READY"
                          ]
                        },
                        "contentType": {
                          "type": "string",
                          "enum": [
                            "image/png",
                            "image/jpeg",
                            "image/webp",
                            "image/gif"
                          ]
                        },
                        "byteSize": {
                          "type": "integer"
                        },
                        "widthPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "heightPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "sha256": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "SERVER-computed hash of the immutable stored bytes (READY only)."
                        },
                        "uploaderRole": {
                          "type": "string",
                          "enum": [
                            "EMPLOYER",
                            "WORKER"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": false
                    },
                    "upload": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "null when the reservation is already READY. The signed single-PUT grant is SHORT-LIVED, path-scoped, upsert-DISABLED, minted fresh per authorized call, and never persisted — treat as a secret in transit (the response is served Cache-Control: private, no-store).",
                      "required": [
                        "signedPut",
                        "expiresAt"
                      ],
                      "properties": {
                        "signedPut": {
                          "type": "object",
                          "required": [
                            "url",
                            "headers"
                          ],
                          "properties": {
                            "url": {
                              "type": "string"
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid content type, size, or missing Idempotency-Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing project_todos:write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment missing or foreign (indistinguishable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Reservation invalidated by a failed verification — start fresh",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Upload rate lane exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}/assets/{assetId}/finalize": {
      "post": {
        "operationId": "projectTodoQuizCoachingAssetFinalize",
        "tags": [
          "project-todos"
        ],
        "summary": "Verify the uploaded bytes server-side and commit the reservation READY",
        "description": "Employer-only and bound to the reservation owner (another actor on the same assignment gets the same opaque 404 as a missing asset). Independently streams the stored object (bounded, timed out, cache-bypassing) and enforces reserved size, magic bytes, dimensions, pixel limits, and a server-computed SHA-256 before a CONDITIONAL PENDING→READY commit that is safe under concurrent finalizers. Invalid bytes invalidate the reservation DB-first (a concurrently committed READY object is never deleted) — recovery is a NEW reservation. A wrong optional `expectedSha256` over valid bytes is a typed CHECKSUM_MISMATCH that leaves the reservation PENDING.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedSha256": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$",
                    "description": "Optional client cross-check only — never server proof. A mismatch is a typed CHECKSUM_MISMATCH conflict that leaves the reservation PENDING."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified asset",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asset",
                    "replayed"
                  ],
                  "properties": {
                    "asset": {
                      "type": "object",
                      "required": [
                        "assetId",
                        "status",
                        "contentType",
                        "byteSize",
                        "widthPx",
                        "heightPx",
                        "sha256",
                        "uploaderRole",
                        "createdAt"
                      ],
                      "properties": {
                        "assetId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "READY"
                          ]
                        },
                        "contentType": {
                          "type": "string",
                          "enum": [
                            "image/png",
                            "image/jpeg",
                            "image/webp",
                            "image/gif"
                          ]
                        },
                        "byteSize": {
                          "type": "integer"
                        },
                        "widthPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "heightPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "sha256": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "SERVER-computed hash of the immutable stored bytes (READY only)."
                        },
                        "uploaderRole": {
                          "type": "string",
                          "enum": [
                            "EMPLOYER",
                            "WORKER"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Asset missing, foreign, or reserved by another actor/lane",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_INCOMPLETE (nothing stored yet), UPLOAD_VERIFICATION_FAILED (transient — retry), or CHECKSUM_MISMATCH (fix the cross-check)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "IMAGE_INVALID — reservation invalidated; start a new upload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Upload rate lane exhausted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}/assets/{assetId}": {
      "get": {
        "operationId": "projectTodoQuizCoachingAssetStatus",
        "tags": [
          "project-todos"
        ],
        "summary": "Read a private feedback image’s lifecycle status",
        "description": "Employer-only: requires `project_todos:read` plus organization/job access. Missing and foreign assets are indistinguishable.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Asset status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asset"
                  ],
                  "properties": {
                    "asset": {
                      "type": "object",
                      "required": [
                        "assetId",
                        "status",
                        "contentType",
                        "byteSize",
                        "widthPx",
                        "heightPx",
                        "sha256",
                        "uploaderRole",
                        "createdAt"
                      ],
                      "properties": {
                        "assetId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "READY"
                          ]
                        },
                        "contentType": {
                          "type": "string",
                          "enum": [
                            "image/png",
                            "image/jpeg",
                            "image/webp",
                            "image/gif"
                          ]
                        },
                        "byteSize": {
                          "type": "integer"
                        },
                        "widthPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "heightPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "sha256": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "SERVER-computed hash of the immutable stored bytes (READY only)."
                        },
                        "uploaderRole": {
                          "type": "string",
                          "enum": [
                            "EMPLOYER",
                            "WORKER"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Asset not found (missing ≡ foreign)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}/assets/{assetId}/delivery": {
      "get": {
        "operationId": "projectTodoQuizCoachingAssetDelivery",
        "tags": [
          "project-todos"
        ],
        "summary": "Mint a short-lived signed delivery grant for a READY feedback image",
        "description": "Same read authorization as status. READY assets only (PENDING is a typed UPLOAD_INCOMPLETE conflict). The 300-second signed READ grant is minted per request and never persisted; the response is served `Cache-Control: private, no-store`.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery grant",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asset",
                    "delivery"
                  ],
                  "properties": {
                    "asset": {
                      "type": "object",
                      "required": [
                        "assetId",
                        "status",
                        "contentType",
                        "byteSize",
                        "widthPx",
                        "heightPx",
                        "sha256",
                        "uploaderRole",
                        "createdAt"
                      ],
                      "properties": {
                        "assetId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "READY"
                          ]
                        },
                        "contentType": {
                          "type": "string",
                          "enum": [
                            "image/png",
                            "image/jpeg",
                            "image/webp",
                            "image/gif"
                          ]
                        },
                        "byteSize": {
                          "type": "integer"
                        },
                        "widthPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "heightPx": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "sha256": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "SERVER-computed hash of the immutable stored bytes (READY only)."
                        },
                        "uploaderRole": {
                          "type": "string",
                          "enum": [
                            "EMPLOYER",
                            "WORKER"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": false
                    },
                    "delivery": {
                      "type": "object",
                      "required": [
                        "url",
                        "expiresAt"
                      ],
                      "description": "Short-lived signed READ grant — minted per request, never persisted; the response is served Cache-Control: private, no-store.",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Asset not found (missing ≡ foreign)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "UPLOAD_INCOMPLETE — finalize the upload first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}": {
      "get": {
        "operationId": "projectTodoQuizCoachingState",
        "tags": [
          "project-todos"
        ],
        "summary": "Read the bounded coaching state for one submitted quiz assignment",
        "description": "Requires `project_todos:read` and employer access to the assignment’s exact job. Returns `view: \"state\"` with the current DRAFT selection cycle, the live OPEN/RESUBMITTED cycle, the 10 most recent cycles (full history is the cycles page), bounded thread summaries, and the latest submitted attempt — never answer keys and never an unbounded relation load.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coaching state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "view",
                    "assignmentId",
                    "jobId",
                    "contractId",
                    "assignment",
                    "form",
                    "completionPolicy",
                    "latestSubmittedAttempt",
                    "attemptInProgress",
                    "draftCycle",
                    "liveCycle",
                    "recentCycles",
                    "cycleCount",
                    "cyclesTruncated",
                    "threadSummaries",
                    "threadsTruncated"
                  ],
                  "properties": {
                    "view": {
                      "type": "string",
                      "enum": [
                        "state"
                      ]
                    },
                    "assignmentId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "assignment": {
                      "type": "object",
                      "required": [
                        "status",
                        "waitingOnRole",
                        "deadline"
                      ],
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "OPEN",
                            "IN_PROGRESS",
                            "SUBMITTED",
                            "COMPLETED",
                            "RETURNED",
                            "WAIVED",
                            "CLOSED",
                            "SUPERSEDED"
                          ]
                        },
                        "waitingOnRole": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "WORKER",
                            "EMPLOYER",
                            "NONE",
                            null
                          ]
                        },
                        "deadline": {
                          "type": "object",
                          "required": [
                            "dueAt",
                            "blockAt",
                            "overdue",
                            "dueSoon"
                          ],
                          "properties": {
                            "dueAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "blockAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "overdue": {
                              "type": "boolean"
                            },
                            "dueSoon": {
                              "type": "boolean"
                            },
                            "inheritedUnchanged": {
                              "type": "boolean"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "form": {
                      "type": "object",
                      "required": [
                        "title",
                        "formVersionId"
                      ],
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "formVersionId": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "completionPolicy": {
                      "type": "string",
                      "enum": [
                        "ON_SUBMIT",
                        "ON_PASS",
                        "ON_REVIEW"
                      ]
                    },
                    "latestSubmittedAttempt": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "required": [
                        "attemptId",
                        "attemptNumber",
                        "submittedAt",
                        "attemptKind",
                        "reviewable"
                      ],
                      "properties": {
                        "attemptId": {
                          "type": "string"
                        },
                        "attemptNumber": {
                          "type": "integer"
                        },
                        "submittedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "attemptKind": {
                          "type": "string",
                          "enum": [
                            "REMEDIATION",
                            "FULL"
                          ]
                        },
                        "reviewable": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    "attemptInProgress": {
                      "type": "boolean"
                    },
                    "draftCycle": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "The current DRAFT selection cycle plus requestedQuestions labels (id + prompt only).",
                      "properties": {
                        "reviewCycleId": {
                          "type": "string"
                        },
                        "cycleNumber": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "OPEN",
                            "RESUBMITTED",
                            "CLOSED"
                          ]
                        },
                        "sourceAttemptId": {
                          "type": "string"
                        },
                        "requestedQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sentAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "closedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "closedReason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "ACCEPTED",
                            "GRADED",
                            "SUPERSEDED",
                            "CANCELLED",
                            null
                          ]
                        },
                        "requestedQuestions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "questionId",
                              "prompt"
                            ],
                            "properties": {
                              "questionId": {
                                "type": "string"
                              },
                              "prompt": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "reviewCycleId",
                        "cycleNumber",
                        "status",
                        "sourceAttemptId",
                        "requestedQuestionIds",
                        "reason",
                        "sentAt",
                        "closedAt",
                        "closedReason",
                        "requestedQuestions"
                      ],
                      "additionalProperties": false
                    },
                    "liveCycle": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "required": [
                        "reviewCycleId",
                        "cycleNumber",
                        "status",
                        "sourceAttemptId",
                        "requestedQuestionIds",
                        "reason",
                        "sentAt",
                        "closedAt",
                        "closedReason"
                      ],
                      "properties": {
                        "reviewCycleId": {
                          "type": "string"
                        },
                        "cycleNumber": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "OPEN",
                            "RESUBMITTED",
                            "CLOSED"
                          ]
                        },
                        "sourceAttemptId": {
                          "type": "string"
                        },
                        "requestedQuestionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sentAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "closedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "closedReason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "ACCEPTED",
                            "GRADED",
                            "SUPERSEDED",
                            "CANCELLED",
                            null
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "recentCycles": {
                      "type": "array",
                      "maxItems": 10,
                      "items": {
                        "type": "object",
                        "required": [
                          "reviewCycleId",
                          "cycleNumber",
                          "status",
                          "sourceAttemptId",
                          "requestedQuestionIds",
                          "reason",
                          "sentAt",
                          "closedAt",
                          "closedReason"
                        ],
                        "properties": {
                          "reviewCycleId": {
                            "type": "string"
                          },
                          "cycleNumber": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "OPEN",
                              "RESUBMITTED",
                              "CLOSED"
                            ]
                          },
                          "sourceAttemptId": {
                            "type": "string"
                          },
                          "requestedQuestionIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sentAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "closedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "closedReason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "ACCEPTED",
                              "GRADED",
                              "SUPERSEDED",
                              "CANCELLED",
                              null
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "cycleCount": {
                      "type": "integer"
                    },
                    "cyclesTruncated": {
                      "type": "boolean"
                    },
                    "threadSummaries": {
                      "type": "array",
                      "maxItems": 500,
                      "items": {
                        "type": "object",
                        "required": [
                          "threadId",
                          "questionId",
                          "status",
                          "lastActivityAt",
                          "resolvedAt"
                        ],
                        "properties": {
                          "threadId": {
                            "type": "string"
                          },
                          "questionId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "RESOLVED"
                            ]
                          },
                          "lastActivityAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "resolvedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "threadsTruncated": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign assignment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment not found or not a NATIVE_FORM to-do",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}/cycles": {
      "get": {
        "operationId": "projectTodoQuizCoachingCycles",
        "tags": [
          "project-todos"
        ],
        "summary": "Page the full coaching cycle history for one assignment (keyset)",
        "description": "Requires `project_todos:read` and employer access. Drafts included (employer-only view). Response `view: \"cycles\"`.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coaching cycle page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "view",
                    "assignmentId",
                    "cycles",
                    "nextCursor"
                  ],
                  "properties": {
                    "view": {
                      "type": "string",
                      "enum": [
                        "cycles"
                      ]
                    },
                    "assignmentId": {
                      "type": "string"
                    },
                    "cycles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "reviewCycleId",
                          "cycleNumber",
                          "status",
                          "sourceAttemptId",
                          "requestedQuestionIds",
                          "reason",
                          "sentAt",
                          "closedAt",
                          "closedReason"
                        ],
                        "properties": {
                          "reviewCycleId": {
                            "type": "string"
                          },
                          "cycleNumber": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "OPEN",
                              "RESUBMITTED",
                              "CLOSED"
                            ]
                          },
                          "sourceAttemptId": {
                            "type": "string"
                          },
                          "requestedQuestionIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sentAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "closedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "closedReason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "ACCEPTED",
                              "GRADED",
                              "SUPERSEDED",
                              "CANCELLED",
                              null
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign assignment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}/threads": {
      "get": {
        "operationId": "projectTodoQuizCoachingThreads",
        "tags": [
          "project-todos"
        ],
        "summary": "Page feedback thread summaries with visible-comment counts (keyset)",
        "description": "Requires `project_todos:read` and employer access. Summaries only — comment bodies ride the per-thread comments page. Response `view: \"threads\"`.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coaching thread page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "view",
                    "assignmentId",
                    "threads",
                    "nextCursor"
                  ],
                  "properties": {
                    "view": {
                      "type": "string",
                      "enum": [
                        "threads"
                      ]
                    },
                    "assignmentId": {
                      "type": "string"
                    },
                    "threads": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "questionId",
                          "status",
                          "lastActivityAt",
                          "resolvedAt",
                          "commentCount",
                          "workerVisibleCommentCount"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "questionId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "RESOLVED"
                            ]
                          },
                          "lastActivityAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "resolvedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "commentCount": {
                            "type": "integer"
                          },
                          "workerVisibleCommentCount": {
                            "type": "integer"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign assignment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/project-todos/quizzes/coaching/{assignmentId}/threads/{threadId}/comments": {
      "get": {
        "operationId": "projectTodoQuizCoachingComments",
        "tags": [
          "project-todos"
        ],
        "summary": "Page one feedback thread’s comments (keyset, employer view)",
        "description": "Requires `project_todos:read` and employer access. Includes private draft-batch comments with their cycle number and per-comment worker visibility. Response `view: \"comments\"`.",
        "parameters": [
          {
            "name": "assignmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coaching comment page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "view",
                    "threadId",
                    "comments",
                    "nextCursor"
                  ],
                  "properties": {
                    "view": {
                      "type": "string",
                      "enum": [
                        "comments"
                      ]
                    },
                    "threadId": {
                      "type": "string"
                    },
                    "comments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "authorRole",
                          "authorUserId",
                          "createdAt",
                          "cycleNumber",
                          "erased",
                          "bodyDoc",
                          "bodyText"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "authorRole": {
                            "type": "string",
                            "enum": [
                              "EMPLOYER",
                              "WORKER"
                            ]
                          },
                          "authorUserId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "cycleNumber": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "erased": {
                            "type": "boolean"
                          },
                          "bodyDoc": {
                            "description": "Rich doc JSON (null when erased).",
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "$ref": "#/components/schemas/ProjectTodoJsonValue"
                              }
                            ]
                          },
                          "bodyText": {
                            "type": "string"
                          },
                          "workerVisible": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, device token, or foreign assignment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment or thread not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations": {
      "get": {
        "tags": [
          "job-integrations"
        ],
        "summary": "List provider-neutral job integrations",
        "description": "Requires `integrations:read`, the default-off project-todos agent surface, a claimed account, and employer provider access (organization OWNER or provider-authorized member — ordinary members cannot discover shared provider configuration). Lists every registered project-action provider adapter with masked connection state (masked credential suffix + external organization id only — never secrets), job mapping status, and provisioning capability.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Registered providers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "jobId",
                    "providers",
                    "nextCursor"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "providers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "provider",
                          "supportsProvisioning",
                          "configured",
                          "connection"
                        ],
                        "properties": {
                          "provider": {
                            "type": "string"
                          },
                          "supportsProvisioning": {
                            "type": "boolean"
                          },
                          "configured": {
                            "type": "boolean"
                          },
                          "mappingStatus": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "connection": {
                            "type": "object",
                            "required": [
                              "connected"
                            ],
                            "properties": {
                              "connected": {
                                "type": "boolean"
                              },
                              "maskedSuffix": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "externalOrganizationId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "updatedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, agent surface disabled, unclaimed account, foreign job, or no provider access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/status": {
      "get": {
        "tags": [
          "job-integrations"
        ],
        "summary": "Get masked integration status",
        "description": "Requires `integrations:read` + employer provider access. Masked status for one provider on one job: connection health (masked suffix only), project mapping with last sync state, and per-contract enrollment/verification records with masked invite addresses. Credentials and secrets are never returned.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeProviderReadback",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Opt in to live provider readback (active member / pending invite counts) inside organizationHealth. Off by default so a polled status never fans out to the provider API; the database-derived health block is always returned."
          }
        ],
        "responses": {
          "200": {
            "description": "Masked integration status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "provider",
                    "jobId",
                    "enabled",
                    "connection",
                    "organizationHealth",
                    "organizationHealthAvailability",
                    "enrollments"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "connection": {
                      "type": "object",
                      "required": [
                        "connected"
                      ],
                      "properties": {
                        "connected": {
                          "type": "boolean"
                        },
                        "maskedSuffix": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "externalOrganizationId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "updatedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "mapping": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "organizationHealth": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true,
                      "description": "Organization-wide masked provider health (DEV-3283): connection, mapping sync health, enrollment counts split by provenance (confirmed / owner-attested / legacy-no-provenance) and ended-but-unrevoked seats, provider readback counts of active members and pending invites when the provider supports them, and billing fields (plan, seat limit, cadence, payment method, next billing date) reported as an explicit UNAVAILABLE marker because the provider API does not expose them. Counts and statuses only; never secrets, emails, or names."
                    },
                    "organizationHealthAvailability": {
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "AVAILABLE"
                              ]
                            }
                          }
                        },
                        {
                          "type": "object",
                          "required": [
                            "state",
                            "code"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "UNAVAILABLE"
                              ]
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "ORGANIZATION_HEALTH_NOT_SUPPORTED",
                                "ORGANIZATION_HEALTH_QUERY_FAILED"
                              ]
                            }
                          }
                        }
                      ],
                      "description": "Explicit availability for organizationHealth. A failed or unsupported health query never silently masquerades as an empty/null healthy result."
                    },
                    "enrollments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Per-contract enrollment: status, verification timestamps, and a masked invite address (x***@domain). Raw emails never appear."
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or no provider access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or provider not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/config": {
      "post": {
        "tags": [
          "job-integrations"
        ],
        "summary": "Update masked integration configuration",
        "description": "Requires `integrations:write` + employer provider access. `config.enabled: true` with `config.externalProjectId` maps/activates the provider project and queues the initial canonical sync, but does not invite any hires. Assign the returned `setupTodo.itemId` through `/project-todos/manage` with `action: assign`; that is the canonical audience and audit control plane. `config.enabled: false` disables the mapping and archives the setup obligation while retaining all history. Credential connect/disconnect deliberately stays in the web app: no token or secret material is ever accepted or returned.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "jobId",
                  "provider",
                  "config"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "jobId": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string"
                  },
                  "config": {
                    "type": "object",
                    "required": [
                      "enabled"
                    ],
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "externalProjectId": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated masked configuration",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "provider",
                    "jobId",
                    "enabled",
                    "syncQueued"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "mapping": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "setupTodo": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": true
                    },
                    "syncQueued": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing externalProjectId or unsupported provider",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or no provider access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or provider not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Provider is not configured for this organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/assign": {
      "post": {
        "tags": [
          "job-integrations"
        ],
        "summary": "Assign an integration to a hired contract",
        "deprecated": true,
        "description": "Deprecated compatibility wrapper for one contract. Prefer `/project-todos/manage` with `action: assign` on the configured provider setup to-do so selected/current/future audiences and audit history share one control plane. Requires `integrations:write` + employer provider access and remains replay safe.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "provider",
                  "contractId"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "provider": {
                    "type": "string"
                  },
                  "contractId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enrollment state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "provider",
                    "contractId",
                    "status",
                    "verified"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "verified": {
                      "type": "boolean"
                    },
                    "invitedEmailMasked": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Provider does not support agent-managed assignment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or no provider access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract or provider not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Provider mapping missing for this contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/reconcile": {
      "post": {
        "tags": [
          "job-integrations"
        ],
        "summary": "Reconcile integration state for a contract",
        "description": "Requires `integrations:write`. Reconciliation first checks canonical imported proof through the fail-closed provider registry. When a time provider is ready but fresh proof is missing, it queues a bounded verification probe and returns CHECK_QUEUED/CHECK_RUNNING, nextAction, and retryAfterSeconds. A verified fact completes the exact provider-owned obligation with evidence + audit history idempotently. Employers (with provider access) reconcile any contract on their jobs; workers only their own contract, with a stable retry message instead of provider diagnostics.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "provider",
                  "contractId"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "provider": {
                    "type": "string"
                  },
                  "contractId": {
                    "type": "string"
                  },
                  "assignmentId": {
                    "type": "string",
                    "description": "Optional exact obligation; omit for contract-wide."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reconciliation outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "provider",
                    "contractId",
                    "status",
                    "verified",
                    "verificationState",
                    "nextAction",
                    "retryAfterSeconds",
                    "automaticCheck"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "verified": {
                      "type": "boolean"
                    },
                    "verificationState": {
                      "type": "string",
                      "enum": [
                        "VERIFIED",
                        "ACTION_REQUIRED",
                        "CHECK_QUEUED",
                        "CHECK_RUNNING"
                      ]
                    },
                    "nextAction": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "ACCEPT_INVITATION",
                        "RUN_DESKTOP_TIMER",
                        "WAIT_FOR_PROVIDER",
                        "CONTACT_PROJECT_MANAGER",
                        null
                      ]
                    },
                    "retryAfterSeconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "automaticCheck": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or foreign contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract or provider not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The employer has not connected this integration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Provider verification temporarily unavailable (worker calls)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/verify": {
      "post": {
        "tags": [
          "job-integrations"
        ],
        "summary": "Verify one integration obligation",
        "description": "Requires `integrations:write`. Assignment-scoped verification uses the same exact-obligation choke point. Provider-ready time checks may queue a bounded fresh-proof probe and return its check state and retry guidance; one verified external fact can never complete a different obligation. Employers verify any contract on their jobs; workers only their own.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "provider",
                  "contractId",
                  "assignmentId"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "provider": {
                    "type": "string"
                  },
                  "contractId": {
                    "type": "string"
                  },
                  "assignmentId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "provider",
                    "contractId",
                    "assignmentId",
                    "status",
                    "verified",
                    "verificationState",
                    "nextAction",
                    "retryAfterSeconds",
                    "automaticCheck"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "assignmentId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "verified": {
                      "type": "boolean"
                    },
                    "verificationState": {
                      "type": "string",
                      "enum": [
                        "VERIFIED",
                        "ACTION_REQUIRED",
                        "CHECK_QUEUED",
                        "CHECK_RUNNING"
                      ]
                    },
                    "nextAction": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "ACCEPT_INVITATION",
                        "RUN_DESKTOP_TIMER",
                        "WAIT_FOR_PROVIDER",
                        "CONTACT_PROJECT_MANAGER",
                        null
                      ]
                    },
                    "retryAfterSeconds": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "automaticCheck": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or foreign contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Assignment, contract, or provider not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Provider verification temporarily unavailable (worker calls)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/conversation": {
      "post": {
        "tags": [
          "messages"
        ],
        "summary": "Start (or fetch) the pre-hire conversation for a proposal",
        "description": "Requires `messages:write` + the `public_api_messaging_writes` feature + a claimed account. Idempotent get-or-create; only the employer side can open the thread. After creation, send messages via `POST /messages`.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Conversation handle",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "conversationId",
                    "proposalId",
                    "created"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "conversationId": {
                      "type": "string"
                    },
                    "proposalId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "created": {
                      "type": "boolean",
                      "description": "true when this call created the conversation"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, unclaimed account, or not the employer side",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Proposal is missing data required for messaging",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/proposals/{proposalId}/hire": {
      "post": {
        "tags": [
          "proposals"
        ],
        "summary": "Request hiring the candidate behind a proposal (human co-sign)",
        "description": "Requires `proposals:write` + `public_api_hiring` + a claimed account. Does NOT hire or move money: records a pending approval and returns `202` with an `approvalUrl` a signed-in human must open and confirm in the OpenTrain app (~72h expiry). The human confirms the hire in the normal hiring interface (and can adjust the milestone terms there). Poll `/updates` for `approval.confirmed` or re-check `GET /approvals/{approvalId}` — the confirmed approval `result` includes the new `contractId`. `409 payment_method_required` includes a `billingUrl`; it is never returned to an Admin Pay actor, who funds with Admin Balance when confirming.",
        "parameters": [
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "milestone"
                ],
                "properties": {
                  "milestone": {
                    "type": "object",
                    "description": "DEV-4500: give amount, volume (hours; hourly proposals only), or both. With volume the amount is volume × the contract rate (the applicant’s bid); with both, a mismatch is a 400.",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 2000
                      },
                      "amount": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "volume": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "description": "Funded hours (hourly proposals). Recorded on the milestone so budget.fundedVolume reflects them."
                      },
                      "dueDate": {
                        "type": "string"
                      }
                    }
                  },
                  "confirmNotFitOverride": {
                    "type": "boolean"
                  },
                  "rateUsd": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "description": "DEV-4500: requested contract rate (USD/hour). The contract rate defaults to the applicant’s bid unless you pass rateUsd; the hire always executes at the bid and a different rate is proposed to the worker when the human confirms the hire (PENDING until the worker accepts) — a rate different from the bid needs the worker’s acceptance and is never written silently."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Approval recorded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "approval",
                    "rate",
                    "warnings",
                    "message"
                  ],
                  "properties": {
                    "approval": {
                      "$ref": "#/components/schemas/ApprovalRequest"
                    },
                    "rate": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "paymentType",
                        "contractRateUsd",
                        "bidRateUsd",
                        "postedRateUsd",
                        "requestedRateUsd",
                        "status",
                        "compensationChangeId",
                        "compensationChangeStatus",
                        "failureCode",
                        "message"
                      ],
                      "properties": {
                        "paymentType": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "contractRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The rate the contract is created at: always the applicant’s bid."
                        },
                        "bidRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "postedRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "The job’s posted hourly rate (null for non-hourly jobs)."
                        },
                        "requestedRateUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "BID",
                            "PENDING_WORKER_ACCEPTANCE",
                            "PROPOSAL_RESOLVED",
                            "PROPOSAL_FAILED",
                            "PROPOSAL_UNKNOWN"
                          ],
                          "description": "PENDING_WORKER_ACCEPTANCE: the requested rate is proposed and still pending. PROPOSAL_RESOLVED: it was proposed and the worker (or a later proposal) already resolved it — see compensationChangeStatus. PROPOSAL_FAILED: the hire completed at the bid and the rate proposal is confirmed NOT recorded (or, with failureCode RATE_PROPOSAL_KEY_REUSED, this key is bound to a change at a different rate). PROPOSAL_UNKNOWN: the hire completed, the proposal threw and its outcome could not be confirmed. `contracts propose-rate` converges on an existing pending proposal for the same rate, so retrying is safe."
                        },
                        "compensationChangeId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "compensationChangeStatus": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "PENDING",
                            "ACCEPTED",
                            "DECLINED",
                            "APPEALED",
                            "APPEAL_ACCEPTED",
                            "SUPERSEDED",
                            "CANCELED",
                            null
                          ],
                          "description": "The compensation change’s lifecycle as read back after the hire; null when nothing was proposed or the readback failed."
                        },
                        "failureCode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "RATE_PROPOSAL_FAILED",
                            "RATE_PROPOSAL_UNKNOWN",
                            "RATE_PROPOSAL_KEY_REUSED",
                            null
                          ],
                          "description": "Bounded code set exactly when status is PROPOSAL_FAILED or PROPOSAL_UNKNOWN; never raw error text."
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Proposal not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Payment method required (billingUrl) or proposal state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/freelancers/{idOrSlug}": {
      "get": {
        "tags": [
          "freelancers"
        ],
        "summary": "Get a public freelancer profile",
        "description": "Same masking as the public profile page: skills, work history, portfolio, stats. Never includes personal contact details. Contact strings embedded in candidate-authored free text (title, bio, city, skill/language strings, agency name/industry text, and label/work/education text) are replaced server-side with explicit [REDACTED_EMAIL] / [REDACTED_PHONE] / [REDACTED_PHYSICAL_ADDRESS] / [REDACTED_CONTACT_HANDLE] placeholders, and the response carries a field-level `redactions` provenance array (field path, kind, token, count, source — never the removed value). Employer-authored review comments (`reviews[].comment`) go through the same pass and also lose links ([REDACTED_LINK]: URLs, www addresses, hosts with a path, and domain names under country-code or common top-level domains), recorded with source `EMPLOYER_REVIEW` and field `reviews[<index>].comment` (DEV-3129); a clean comment gets no entry. The stored review is unchanged. `agency.website` stays as a public business field.",
        "parameters": [
          {
            "name": "idOrSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Freelancer profile",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "required": [
                    "freelancer"
                  ],
                  "properties": {
                    "freelancer": {
                      "type": "object",
                      "additionalProperties": true,
                      "required": [
                        "identityVerified",
                        "identityVerification"
                      ],
                      "properties": {
                        "identityVerified": {
                          "type": "boolean",
                          "description": "The Identity verified badge: `identityVerification.verified` and the profile name matches the name on the verified ID (`nameMatchesProfile` is not false). Derived from the shared verdict; never independently read."
                        },
                        "identityVerification": {
                          "type": "object",
                          "description": "The ONE shared identity verdict (DEV-2922) plus the deprecated `identityCountryCode` alias of `countryCode`. Field-identical to CandidateIdentityVerdict except for the alias.",
                          "additionalProperties": false,
                          "required": [
                            "status",
                            "verified",
                            "provider",
                            "countryCode",
                            "verifiedAt",
                            "expiresAt",
                            "updatedAt",
                            "current",
                            "asOf",
                            "source",
                            "conflict",
                            "nameMatchesProfile",
                            "identityCountryCode"
                          ],
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "REQUIRED_NOT_REQUESTED",
                                "REQUESTED",
                                "IN_PROGRESS",
                                "VERIFIED",
                                "FAILED",
                                "EXPIRED",
                                "NEEDS_REVIEW",
                                "CANCELED",
                                "NOT_REQUESTED",
                                "UNKNOWN"
                              ]
                            },
                            "verified": {
                              "type": "boolean"
                            },
                            "provider": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "enum": [
                                "DIDIT",
                                "STRIPE_IDENTITY",
                                null
                              ]
                            },
                            "countryCode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "verifiedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "expiresAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "current": {
                              "type": "boolean",
                              "description": "True only for an unexpired VERIFIED verdict as of `asOf`."
                            },
                            "asOf": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "CANONICAL_VERIFICATION_RECORD",
                                "LEGACY_STRIPE",
                                "NONE"
                              ]
                            },
                            "conflict": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "additionalProperties": false,
                              "required": [
                                "reason",
                                "detail"
                              ],
                              "properties": {
                                "reason": {
                                  "type": "string",
                                  "enum": [
                                    "CANONICAL_LEGACY_DISAGREEMENT"
                                  ]
                                },
                                "detail": {
                                  "type": "string",
                                  "description": "Status names only."
                                }
                              }
                            },
                            "nameMatchesProfile": {
                              "type": [
                                "boolean",
                                "null"
                              ],
                              "description": "OPE-44675: whether the profile name matches the name on the verified ID. False means the Identity verified badge is hidden for this name; null means the verdict is not current or the name was never checked."
                            },
                            "identityCountryCode": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "deprecated": true,
                              "description": "Deprecated alias of `countryCode`."
                            }
                          }
                        },
                        "redactions": {
                          "type": "array",
                          "description": "DEV-2847: field-level contact-redaction provenance for candidate-authored free text, plus employer-authored review comments under source EMPLOYER_REVIEW (DEV-3129). Always stamped, including []; never the removed value.",
                          "items": {
                            "$ref": "#/components/schemas/CandidateContactRedaction"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Freelancer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/pilot-rounds": {
      "get": {
        "tags": [
          "pilots"
        ],
        "summary": "List a project's pilot rounds",
        "description": "Requires `open-label:read`. Rounds on projects outside your organization are indistinguishable from missing.",
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pilot rounds",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Project not found (or not accessible)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "pilots"
        ],
        "summary": "Create and staff a pilot round",
        "description": "Requires `open-label:write`. Creates ONE immutable sample batch (overlap = participant count) and one batch-scoped assignment per participant. Unpaid testing round by default; participants already hired on the linked job keep their contract attached. 2–10 participants; sample via explicit taskIds or gold-aware sampleSize (gold tasks fill up to half the sample). Set blind=true to mask participant identities until the round is decided. The labeling config is fingerprinted at create — mid-round changes are flagged by the comparison neutrality check.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "projectId",
                  "name",
                  "participantUserIds"
                ],
                "properties": {
                  "projectId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "participantUserIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "taskIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "sampleSize": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200
                  },
                  "blind": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created round",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid participants/sample",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found (or not accessible)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/pilot-rounds/{roundId}": {
      "get": {
        "tags": [
          "pilots"
        ],
        "summary": "Get a pilot round",
        "description": "Requires `open-label:read`.",
        "parameters": [
          {
            "name": "roundId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Round + pilots",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Round not found (or not accessible)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/pilot-rounds/{roundId}/comparison": {
      "get": {
        "tags": [
          "pilots"
        ],
        "summary": "Level-field comparison for a round",
        "description": "Requires `open-label:read`. One entry per pilot with same-basis batch-scoped quality metrics (gold accuracy, agreement, approval rate, rework, lead time, skip/issue counts, turnaround span, submitted task ids for deliverable inspection), submission progress, and a neutrality check that flags overlap drift AND mid-round labeling-config/instruction changes. Blind rounds keep identities and task links masked until decided. Buyers only — participants never see the comparison.",
        "parameters": [
          {
            "name": "roundId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Comparison",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Round not found (or not accessible)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Round has no active pilots",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/pilot-rounds/{roundId}/decide": {
      "post": {
        "tags": [
          "pilots"
        ],
        "summary": "Pick the winning pilot",
        "description": "Requires `open-label:write`. The buyer always picks — the platform never auto-decides. Winners/losers are closed cleanly; the response's scaleUp.hirePath points at the existing proposal→hire flow (no money moves through pilots).",
        "parameters": [
          {
            "name": "roundId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "winningPilotId"
                ],
                "properties": {
                  "winningPilotId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decision + scale-up pointer",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Winner must be an active pilot of the round",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Round not found (or not accessible)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Round already decided or closed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/pilot-rounds/{roundId}/close": {
      "post": {
        "tags": [
          "pilots"
        ],
        "summary": "Close a running round without a decision",
        "description": "Requires `open-label:write`. Buyer-side: ends a RUNNING round with no winner (scope changed, wrong sample, project cancelled). Sample assignments complete and participants get a neutral close-out — nobody is marked WON or LOST.",
        "parameters": [
          {
            "name": "roundId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed round",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Round not found (or not accessible)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Only a running round can be closed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/pilot-rounds/{roundId}/withdraw": {
      "post": {
        "tags": [
          "pilots"
        ],
        "summary": "Withdraw yourself from a running round",
        "description": "Requires `open-label:write`, PARTICIPANT-scoped: the authenticated talent withdraws THEMSELVES (unpaid testing work is always voluntary). Submitted work keeps its quality signals; the participant stops being served the sample and drops out of the comparison. Rounds you are not part of return 404.",
        "parameters": [
          {
            "name": "roundId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Withdrawal result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Round not found (or you are not a participant)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Round already concluded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-contributions/catalog": {
      "get": {
        "tags": [
          "open-contributions"
        ],
        "summary": "List open contribution programs",
        "description": "Requires `open-label:read` + the `open_contribution` feature. The catalog of open programs (unpaid, free-to-contribute work across labeling and LLM-era tasks like rubric grading and SFT writing) with capacity, reward policy, and the caller’s join-state.",
        "responses": {
          "200": {
            "description": "Open-program catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "programs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Open contribution is not enabled for this account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-contributions/{projectId}/join": {
      "post": {
        "tags": [
          "open-contributions"
        ],
        "summary": "Join an open program",
        "description": "Requires `open-label:write` + the `open_contribution` feature, personal token: the authenticated talent joins THEMSELVES. Unpaid open work by design — no contract is created and nothing is payable; accepted, independently reviewed contributions build the public track record and portable reputation. Idempotent when already joined; capacity-capped programs return 409.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Join result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Not eligible (account standing) or insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Open program not found (or not accessible)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Program has reached its contributor limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-contributions/{projectId}/leave": {
      "post": {
        "tags": [
          "open-contributions"
        ],
        "summary": "Leave an open program",
        "description": "Requires `open-label:write`, personal token: the authenticated talent leaves an open program (contributing is always voluntary). Accepted contributions keep their public record. Programs you are not part of return 404.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Leave result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Open program not found (or you are not a contributor)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/credentials/{credentialId}": {
      "get": {
        "tags": [
          "open-contributions"
        ],
        "summary": "Fetch an issued talent credential",
        "description": "PUBLIC (no auth): the dereferenceable id URL of an OpenTrain-issued Open Badges 3.0 credential (VC-JWT, Ed25519). Returns the signed credential, its measured results, and live revocation status.",
        "parameters": [
          {
            "name": "credentialId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Credential",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Credential not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/credentials/jwks": {
      "get": {
        "tags": [
          "open-contributions"
        ],
        "summary": "Verification keys (JWKS)",
        "description": "PUBLIC (no auth): the JSON Web Key Set for OpenTrain talent credentials — point any standard JWT tooling here to verify a credential offline.",
        "responses": {
          "200": {
            "description": "JWKS",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/credentials/verify": {
      "post": {
        "tags": [
          "open-contributions"
        ],
        "summary": "Verify a presented talent credential",
        "description": "PUBLIC (no auth): verifies an OpenTrain VC-JWT (signature, issuer, live revocation state) and returns the embedded credential. Offline verifiers can use the JWKS route instead; revocation state is the only part that requires this endpoint.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "credentialJwt"
                ],
                "properties": {
                  "credentialJwt": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "credentialJwt is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-contributions/samples/{submissionId}": {
      "patch": {
        "tags": [
          "open-contributions"
        ],
        "summary": "Curate your own portfolio sample",
        "description": "Requires `open-label:write`, personal token: set featured / order / hidden on YOUR OWN public portfolio sample. Presentation-only — the underlying annotation, record, and ledger are never modified; hiding takes effect immediately on the public profile. Samples that are not your own open-program work return 404.",
        "parameters": [
          {
            "name": "submissionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "featured": {
                    "type": "boolean"
                  },
                  "hidden": {
                    "type": "boolean"
                  },
                  "orderNumber": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated selection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Sample not found (or not your own open-program work)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/open-contributions/model-access": {
      "get": {
        "tags": [
          "open-contributions"
        ],
        "summary": "List your model-access entitlements",
        "description": "Requires `open-label:read`, personal token: the caller’s OWN model/dataset-access entitlements earned through open contributions (record-and-show).",
        "responses": {
          "200": {
            "description": "Model-access entitlements",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entitlements": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`open-label:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/talent/{slug}/open-contributions/samples/{submissionId}": {
      "get": {
        "tags": [
          "talent"
        ],
        "summary": "Inspect one public work sample",
        "description": "Employer-only `talent:read` is required. The read-only detail of one inspectable open-work sample — the contributor's actual submitted annotation (Label Studio result array) plus the label config and task data a read-only renderer needs. Worker principals are refused at mint and at use, including legacy tokens. Open programs only, review-accepted only, never gold/honeypot tasks, contributor-hidden samples excluded — all re-verified live; anything failing any rule is a plain 404. Reading a sample is non-mutating.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "submissionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sample detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`talent:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Talent, sample, or visibility rule not satisfied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/talent/{slug}/open-contributions": {
      "get": {
        "tags": [
          "talent"
        ],
        "summary": "Get a talent's public open-contribution record",
        "description": "Employer-only `talent:read` is required. Per-domain standing tiers and per-program measured records (review-vested accepted units, gold accuracy, review coverage, outcome medals) for one talent, by public profile slug or user id. Worker principals are refused at mint and at use, including legacy tokens. OPEN-ONLY and privacy-safe — paid/confidential work and contact data never appear; 404 for anyone outside the discoverable pool.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Open-contribution record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "talent": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "standings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`talent:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Talent not found or not discoverable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/talent/search": {
      "get": {
        "tags": [
          "talent"
        ],
        "summary": "Search the vetted talent pool",
        "description": "Employer-only `talent:read` is required. Worker principals are refused at mint and at use, including legacy tokens. With `q`, ranks by hybrid semantic + lexical + fuzzy relevance; without `q`, facet-browses ranked by portable reputation. `country` accepts a country name, alpha-2, or alpha-3 value — USA/US, Canada/CA, United Kingdom/GB/GBR, and Australia/AU all normalize to the same filter. `sort=recent` (DEV-3084) is a DETERMINISTIC census of the full discoverable pool ordered `memberSince` DESC, `id` ASC — independent of vector relevance — paged with `cursor` from `nextCursor`; `cursor` requires `sort=recent` and is mutually exclusive with `offset`. `memberSinceFrom`/`memberSinceTo` are inclusive bounds on the canonical membership timestamp and require a full calendar-valid RFC 3339 date-time (date-only or non-ISO values are rejected). The query surface is STRICT: unknown or duplicated query parameters are a typed `400`. Results are privacy-safe aggregate talent cards (masked name, no contact details, no per-buyer breakdowns). Candidate-authored card text (title, bio, city, skills, languages) is sanitized at response time with explicit [REDACTED_*] placeholders plus a per-card `redactions` provenance array (stamped on every returned card, including cards indexed before sanitization). Contact-shaped strings in `q` are neutralized before ranking; a query consisting only of contact data returns an intentional empty result, never a facet-browse fallback.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "skill",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "language",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Country name, alpha-2, or alpha-3 — normalized server-side (USA/US, Canada/CA, United Kingdom/GB/GBR, Australia/AU)."
          },
          {
            "name": "badge",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "VERIFIED_TRAINER"
              ]
            }
          },
          {
            "name": "talentType",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "Individual",
                "Agency"
              ]
            }
          },
          {
            "name": "availability",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "minReputation",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "confidenceTier",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PROVISIONAL",
                "ESTABLISHED",
                "PROVEN"
              ]
            }
          },
          {
            "name": "minHourlyRate",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "available",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "now"
              ]
            },
            "description": "now = no current assignment load (live capacity facet)"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "relevance",
                "reputation",
                "rate_asc",
                "rate_desc",
                "recent"
              ]
            },
            "description": "recent = deterministic full-pool census ordered memberSince DESC, id ASC; page it with cursor, never offset."
          },
          {
            "name": "maxHourlyRate",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque continuation from a previous sort=recent page (nextCursor). Requires sort=recent; mutually exclusive with offset."
          },
          {
            "name": "memberSinceFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive lower bound on the canonical membership timestamp."
          },
          {
            "name": "memberSinceTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive upper bound on the canonical membership timestamp."
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked talent cards + truthful pagination metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "results",
                    "total",
                    "limit",
                    "offset",
                    "nextCursor",
                    "complete",
                    "generatedAt"
                  ],
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "card",
                          "score"
                        ],
                        "properties": {
                          "card": {
                            "$ref": "#/components/schemas/TalentCard"
                          },
                          "score": {
                            "type": [
                              "number",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Opaque continuation for deterministic sort=recent enumeration."
                    },
                    "complete": {
                      "type": "boolean",
                      "description": "True only when the current pagination sequence has no later page."
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter (cursor without sort=recent, cursor+offset, malformed bounds)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`talent:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/talent/match": {
      "get": {
        "tags": [
          "talent"
        ],
        "summary": "Preview best-fit talent for a project",
        "description": "Employer-only `talent:read` is required. Ranks discoverable talent for one of the caller's projects — semantic match against the linked-job text blended with portable reputation. Worker principals are refused at mint and at use, including legacy tokens. Each candidate carries its available commit action (INVITE | ASSIGN | ALREADY_ASSIGNED). Candidate cards are contact-sanitized at the response seam (see TalentCard `redactions`), and `matchedOn` rationale terms that are themselves contact-shaped are omitted. Preview only; a human commits via POST.",
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked match candidates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "project": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "linkedJobId": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    },
                    "candidates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "card": {
                            "$ref": "#/components/schemas/TalentCard"
                          },
                          "matchScore": {
                            "type": "number"
                          },
                          "relevance": {
                            "type": "number",
                            "nullable": true
                          },
                          "commitAction": {
                            "type": "string",
                            "enum": [
                              "INVITE",
                              "ASSIGN",
                              "ALREADY_ASSIGNED"
                            ]
                          },
                          "contractId": {
                            "type": "string",
                            "nullable": true
                          },
                          "matchedOn": {
                            "type": "array",
                            "description": "Candidate-derived match rationale. Contact-shaped terms are omitted at the response seam.",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`talent:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found (or not accessible to this account)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "talent"
        ],
        "summary": "Commit a match action (invite or assign)",
        "description": "Requires `proposals:write`. `action: 'INVITE'` runs the existing job-invite path against the project's linked job; `action: 'ASSIGN'` creates the native project assignment for an already-hired candidate. Both write an audit row.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "projectId",
                  "userId",
                  "action"
                ],
                "properties": {
                  "projectId": {
                    "type": "string"
                  },
                  "userId": {
                    "type": "string"
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "INVITE",
                      "ASSIGN"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Commit outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": [
                        "INVITE",
                        "ASSIGN"
                      ]
                    },
                    "assignmentId": {
                      "type": "string"
                    },
                    "invite": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`proposals:write` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found (or not accessible to this account)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "No linked job / candidate not eligible for the action",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/talent/{slug}/reputation": {
      "get": {
        "tags": [
          "talent"
        ],
        "summary": "Get a talent's portable reputation",
        "description": "Employer-only `talent:read` is required. Worker principals are refused at mint and at use, including legacy tokens. Portable composite score + component breakdown + badges + quality summary for one talent, by public profile slug or user id. Identical for every employer caller; 404 for anyone outside the discoverable pool.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Talent card with reputation + badges",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "talent": {
                      "$ref": "#/components/schemas/TalentCard"
                    },
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope (`talent:read` required)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Talent not found or not discoverable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messages": {
      "get": {
        "tags": [
          "messages"
        ],
        "summary": "List conversations, or messages in one conversation",
        "description": "Requires `messages:read`. Without `conversationId`, lists conversations (filter=all|job|proposal, unreadOnly). With `conversationId`, lists its messages (direction=older|newer).",
        "parameters": [
          {
            "name": "conversationId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "job",
                "proposal"
              ],
              "default": "all"
            }
          },
          {
            "name": "unreadOnly",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "direction",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "older",
                "newer"
              ],
              "default": "older"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Conversations or messages page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "videoReference": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "kind",
                              "referenceId",
                              "assetId",
                              "embedPath",
                              "durationSeconds",
                              "widthPx",
                              "heightPx"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "VIDEO_REFERENCE"
                                ]
                              },
                              "referenceId": {
                                "type": "string"
                              },
                              "assetId": {
                                "type": "string"
                              },
                              "embedPath": {
                                "type": "string",
                                "pattern": "^/api/videos/[^/]+/embed\\?messageId="
                              },
                              "durationSeconds": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "minimum": 0
                              },
                              "widthPx": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 1
                              },
                              "heightPx": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or not a participant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "SERVICE_UNAVAILABLE: a database dependency was unavailable during lookup (details.retryable true, phase execution, retryAfterSeconds; Retry-After header). Retry the same request after the delay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "messages"
        ],
        "summary": "Send a message (by conversation or by contract)",
        "description": "Requires `messages:write` + the `public_api_messaging_writes` feature + a claimed account. Sends into an existing conversation; in proposal threads the employer must message first. Target with EXACTLY ONE of `conversationId` or `contractId` — `contractId` resolves the canonical active-contract Job Message conversation server-side (preferred for agents; never join conversation ids by hand) and the response reports the resolution in `resolved`. Optional `idempotencyKey` (8-200 chars) makes retries safe: the same key + same content returns the stored original with `replayed: true` (HTTP 200) instead of duplicating; the same key with different content or a different conversation is a 409 with `details.reason: \"idempotency_key_conflict\"`. This generic endpoint is intentionally outside automatic Job Operations synchronization. Agents managing a shared job must use `POST /messaging/management/messaging_management.messages.send` (CLI `manager messages send`; MCP `opentrain_send_managed_job_message`) with both `messages:write` and `messages:manage`, a complete guard, and the exact managed idempotency-key contract. The legacy optional `jobOperationsGuard` here is only a stale-message/action precondition and does not attach or advance shared context. Denials are machine-readable: 404 `details.reason: \"conversation_missing\"` means the conversation id does not exist (e.g. a copied/garbled id); 403 reasons distinguish `not_a_participant`, `membership_removed`, and `conversation_hidden`; an authorized contract with no hire-time Job DM is a 409 `details.reason: \"job_dm_missing\"`. Every error envelope carries `requestId` for support correlation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "conversationId": {
                    "type": "string",
                    "description": "Target conversation. Exactly one of conversationId/contractId."
                  },
                  "contractId": {
                    "type": "string",
                    "description": "Target contract; the canonical Job Message conversation is resolved server-side. Exactly one of conversationId/contractId."
                  },
                  "content": {
                    "type": "string",
                    "x-opentrain-trimmed-min-length": 1,
                    "x-opentrain-trimmed-max-length": 10000,
                    "description": "RAW body (never trimmed, normalized, or escape-decoded by any client). The server stores the trimmed canonical value and reports the difference in `delivery`. Literal backslash-n sequences outside Markdown code are refused with 400 LIKELY_ESCAPED_NEWLINES unless allowLiteralEscapes is true."
                  },
                  "allowLiteralEscapes": {
                    "type": "boolean",
                    "description": "DEV-3445: keep literal backslash-n / backslash-r-backslash-n sequences found outside Markdown inline/fenced code instead of failing with 400 LIKELY_ESCAPED_NEWLINES. Default false (fail closed). Real line breaks never need this."
                  },
                  "videoAssetId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "Optional videoAssetId attaches one existing READY, unarchived video atomically to a job message (not a proposal DM). Requires videos:read, same-organization asset access, the message_video_references rollout, and (for token transports) the video_library agent-surface family; either send gate being off returns a typed refusal and never silently drops the reference. Retry with the same asset, key, target and content. Recipient videoReference contains only opaque ids, dimensions and a session-authorized embedPath, not storage URLs or download authority."
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200,
                    "description": "Stable retry key. Same key + same content replays the stored original; same key + different content conflicts (409)."
                  },
                  "jobOperationsGuard": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Legacy generic-send stale-message/action precondition only; it does not attach or advance automatic shared context on this endpoint. Manager agents must use messaging_management.messages.send instead. expectedLatestMessageId is the newest message across the conversation root and every thread reply; null only for an observed-empty conversation.",
                    "required": [
                      "jobId",
                      "expectedContextRevision",
                      "actionId",
                      "expectedActionRevision",
                      "claimReceipt",
                      "expectedLatestMessageId"
                    ],
                    "properties": {
                      "jobId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "expectedContextRevision": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "actionId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "expectedActionRevision": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "claimReceipt": {
                        "type": "string",
                        "minLength": 1
                      },
                      "expectedLatestMessageId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Newest observed message id across the root and every thread; null only for an observed-empty conversation."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored original replayed for a retried idempotency key (replayed: true)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "message": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "videoReference": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "referenceId",
                            "assetId",
                            "embedPath",
                            "durationSeconds",
                            "widthPx",
                            "heightPx"
                          ],
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "VIDEO_REFERENCE"
                              ]
                            },
                            "referenceId": {
                              "type": "string"
                            },
                            "assetId": {
                              "type": "string"
                            },
                            "embedPath": {
                              "type": "string",
                              "pattern": "^/api/videos/[^/]+/embed\\?messageId="
                            },
                            "durationSeconds": {
                              "type": [
                                "number",
                                "null"
                              ],
                              "minimum": 0
                            },
                            "widthPx": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 1
                            },
                            "heightPx": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 1
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Sent message (plus resolved contract → conversation mapping)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "message": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "videoReference": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "referenceId",
                            "assetId",
                            "embedPath",
                            "durationSeconds",
                            "widthPx",
                            "heightPx"
                          ],
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "VIDEO_REFERENCE"
                              ]
                            },
                            "referenceId": {
                              "type": "string"
                            },
                            "assetId": {
                              "type": "string"
                            },
                            "embedPath": {
                              "type": "string",
                              "pattern": "^/api/videos/[^/]+/embed\\?messageId="
                            },
                            "durationSeconds": {
                              "type": [
                                "number",
                                "null"
                              ],
                              "minimum": 0
                            },
                            "widthPx": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 1
                            },
                            "heightPx": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 1
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, unclaimed account, not a participant, removed membership, hidden conversation, or policy block (details.reason)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Conversation id does not exist (details.reason conversation_missing) or contract not found/authorized (contract_not_found)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conversation rules block this send (employer-first, read-only sample), idempotency_key_conflict (including a changed videoAssetId), asset_not_ready, or job_dm_missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (details.retryAfterSeconds)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "SERVICE_UNAVAILABLE: details.reason is message_committed_readback_unavailable (commitState committed, messageId identifies the saved message) or message_send_outcome_unknown (commitState unknown). Neither means rollback. With an original idempotency key, retry only the same key, target and content (retryStrategy same_key_same_payload); without one, read before retrying (read_before_retry, retryable false). A 503 with details.phase execution and no commitState is a database outage before dispatch: nothing was saved, so retry after details.retryAfterSeconds (keep the same key if you sent one). Message persistence and content hashes do not prove external email delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messages/{messageId}": {
      "patch": {
        "tags": [
          "messages"
        ],
        "summary": "Edit a message you sent (author-only, CAS revision)",
        "description": "Requires `messages:write` + the `public_api_messaging_writes` feature + a claimed account. Author-only on the immutable sender: a message someone else sent reads as 404 (never an existence oracle). Use this to correct an already-sent instruction or accidentally shared credential — the stored body is replaced and the prior version is preserved in an append-only server-side revision ledger. Optimistic concurrency is REQUIRED: pass `expectedRevision` equal to the message readback `revision` field (0 for never-edited messages); a stale value is a 409 with `details.reason: \"REVISION_CONFLICT\"` and `details.currentRevision` — re-read and retry. `content` must be non-empty and at most 10,000 characters AFTER trimming (the server stores the trimmed value). The required `Idempotency-Key` header uses the durable-receipt grammar (1-128 chars of `[A-Za-z0-9._:-]`, minimum ONE — not the 8-char managed-send rule): replaying the same key returns the committed result with `replayed: true`. Message list/readback responses carry the additive mutation fields `revision`, `edited`, `lastEditedByUserId`, `deleted`, and `deletedAt`. System messages, moderated messages, and tombstoned messages (including legacy moderator tombstones) are immutable (409 with `details.reason`). Every error envelope carries `requestId`.",
        "parameters": [
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Id of a message the token owner sent."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "content",
                  "expectedRevision"
                ],
                "properties": {
                  "content": {
                    "type": "string",
                    "x-opentrain-trimmed-min-length": 1,
                    "x-opentrain-trimmed-max-length": 10000,
                    "description": "Replacement body. Non-empty and at most 10,000 characters after trimming; the server stores the trimmed value. Literal backslash-n sequences outside Markdown code are refused with 400 LIKELY_ESCAPED_NEWLINES unless allowLiteralEscapes is true."
                  },
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483646,
                    "description": "The message readback `revision` this edit is based on. A stale value is a 409 REVISION_CONFLICT carrying details.currentRevision."
                  },
                  "allowLiteralEscapes": {
                    "type": "boolean",
                    "description": "DEV-3445: keep literal backslash-n / backslash-r-backslash-n sequences found outside Markdown inline/fenced code instead of failing with 400 LIKELY_ESCAPED_NEWLINES. Default false (fail closed). Real line breaks never need this."
                  }
                }
              },
              "example": {
                "content": "Corrected instruction.",
                "expectedRevision": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Edited message readback (or the stored original replayed for a retried key)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "message",
                    "replayed",
                    "delivery"
                  ],
                  "properties": {
                    "message": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "messageId",
                        "conversationId",
                        "operation",
                        "revision",
                        "content",
                        "edited",
                        "editedAt",
                        "lastEditedByUserId",
                        "deleted",
                        "deletedAt"
                      ],
                      "properties": {
                        "messageId": {
                          "type": "string"
                        },
                        "conversationId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "The revision this mutation produced (expectedRevision + 1). Pass it as expectedRevision for the next mutation."
                        },
                        "operation": {
                          "type": "string",
                          "enum": [
                            "EDIT"
                          ]
                        },
                        "content": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 10000
                        },
                        "edited": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "editedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "lastEditedByUserId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "deleted": {
                          "type": "boolean",
                          "enum": [
                            false
                          ]
                        },
                        "deletedAt": {
                          "type": "null"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when this response replays the stored result for a retried key."
                    },
                    "delivery": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "schemaVersion",
                        "rawSha256",
                        "canonicalSha256",
                        "storedSha256",
                        "exactRawMatch",
                        "canonicalMatch",
                        "warnings",
                        "replayed"
                      ],
                      "properties": {
                        "schemaVersion": {
                          "type": "integer",
                          "enum": [
                            1
                          ]
                        },
                        "rawSha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "canonicalSha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "storedSha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "exactRawMatch": {
                          "type": "boolean"
                        },
                        "canonicalMatch": {
                          "type": "boolean"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "code",
                              "message",
                              "occurrences"
                            ],
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "CANONICAL_TRIM_APPLIED",
                                  "CRLF_LINE_ENDINGS",
                                  "LITERAL_ESCAPES_ALLOWED"
                                ]
                              },
                              "message": {
                                "type": "string"
                              },
                              "occurrences": {
                                "type": "integer",
                                "minimum": 0
                              }
                            }
                          }
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "message": {
                    "messageId": "msg_123",
                    "conversationId": "conv_456",
                    "operation": "EDIT",
                    "revision": 1,
                    "content": "Corrected instruction.",
                    "edited": true,
                    "editedAt": "2026-09-01T12:00:00.000Z",
                    "lastEditedByUserId": "user_789",
                    "deleted": false,
                    "deletedAt": null
                  },
                  "replayed": false
                }
              }
            }
          },
          "400": {
            "description": "Missing/invalid content, expectedRevision out of 0..2147483646, or invalid Idempotency-Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, unclaimed account, or CONVERSATION_ACCESS_DENIED (removed membership / revoked access — details.reason)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Message not found OR sent by someone else (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "REVISION_CONFLICT (details.currentRevision), MESSAGE_ALREADY_DELETED, SYSTEM_MESSAGE_IMMUTABLE, MODERATED_MESSAGE_IMMUTABLE, or idempotency-key reuse/in-progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error (requestId for correlation)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "messages"
        ],
        "summary": "Delete a message you sent (author-only tombstone, CAS revision)",
        "description": "Requires `messages:write` + the `public_api_messaging_writes` feature + a claimed account. Author-only on the immutable sender: a message someone else sent reads as 404. This is a NON-destructive tombstone: the row is never removed — content, attachments, and audio read blanked everywhere and prior values survive only in the append-only server-side revision ledger. DELETE carries NO request body: the CAS token travels as the `expectedRevision` query parameter (the message readback `revision`; a stale value is a 409 REVISION_CONFLICT with `details.currentRevision`) and the required `Idempotency-Key` header uses the durable-receipt grammar (1-128 chars of `[A-Za-z0-9._:-]`). Replaying the same key returns the committed result with `replayed: true`. Every error envelope carries `requestId`.",
        "parameters": [
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Id of a message the token owner sent."
          },
          {
            "name": "expectedRevision",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 2147483646
            },
            "description": "The message readback `revision` this delete is based on (DELETE has no request body)."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Stable operation key (durable-receipt contract). Replaying the same key with the same payload converges on the original reservation; a changed payload is a 409."
          }
        ],
        "responses": {
          "200": {
            "description": "Tombstone readback (or the stored original replayed for a retried key)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "message",
                    "replayed"
                  ],
                  "properties": {
                    "message": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "messageId",
                            "conversationId",
                            "operation",
                            "revision",
                            "content",
                            "edited",
                            "editedAt",
                            "lastEditedByUserId",
                            "deleted",
                            "deletedAt"
                          ],
                          "description": "Tombstone that was never edited before deletion.",
                          "properties": {
                            "messageId": {
                              "type": "string"
                            },
                            "conversationId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "description": "The revision this mutation produced (expectedRevision + 1). Pass it as expectedRevision for the next mutation."
                            },
                            "operation": {
                              "type": "string",
                              "enum": [
                                "DELETE"
                              ]
                            },
                            "content": {
                              "type": "null"
                            },
                            "edited": {
                              "type": "boolean",
                              "enum": [
                                false
                              ]
                            },
                            "editedAt": {
                              "type": "null"
                            },
                            "lastEditedByUserId": {
                              "type": "null"
                            },
                            "deleted": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "deletedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "messageId",
                            "conversationId",
                            "operation",
                            "revision",
                            "content",
                            "edited",
                            "editedAt",
                            "lastEditedByUserId",
                            "deleted",
                            "deletedAt"
                          ],
                          "description": "Tombstone with surviving prior-edit history.",
                          "properties": {
                            "messageId": {
                              "type": "string"
                            },
                            "conversationId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "description": "The revision this mutation produced (expectedRevision + 1). Pass it as expectedRevision for the next mutation."
                            },
                            "operation": {
                              "type": "string",
                              "enum": [
                                "DELETE"
                              ]
                            },
                            "content": {
                              "type": "null"
                            },
                            "edited": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "editedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "lastEditedByUserId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1
                            },
                            "deleted": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "deletedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when this response replays the stored result for a retried key."
                    }
                  }
                },
                "example": {
                  "message": {
                    "messageId": "msg_123",
                    "conversationId": "conv_456",
                    "operation": "DELETE",
                    "revision": 2,
                    "content": null,
                    "edited": true,
                    "editedAt": "2026-09-01T12:00:00.000Z",
                    "lastEditedByUserId": "user_789",
                    "deleted": true,
                    "deletedAt": "2026-09-01T13:00:00.000Z"
                  },
                  "replayed": false
                }
              }
            }
          },
          "400": {
            "description": "expectedRevision query parameter missing/out of 0..2147483646, or invalid Idempotency-Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, unclaimed account, or CONVERSATION_ACCESS_DENIED (details.reason)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Message not found OR sent by someone else (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "REVISION_CONFLICT (details.currentRevision), MESSAGE_ALREADY_DELETED, SYSTEM_MESSAGE_IMMUTABLE, MODERATED_MESSAGE_IMMUTABLE, or idempotency-key reuse/in-progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error (requestId for correlation)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messages/{messageId}/attachments/{attachmentId}": {
      "get": {
        "tags": [
          "messages"
        ],
        "summary": "Retrieve one authorized message attachment (bytes, audited)",
        "description": "DEV-2974 / DEV-2921 — `messages.attachments.get`, the ONLY byte-disclosure path for message attachments. Requires `messages:read` and canonical read access to the message's conversation (the same resolver every message read uses). Selector opacity: a missing message, a foreign message, a message in a conversation you cannot read, a sender hidden to you, and an unknown attachment id all read ONE byte-identical opaque 404 whose details carry only `resource: 'message_attachment'` — never an existence oracle; only a missing scope is a typed 403. Tombstoned (author-deleted or legacy placeholder) and moderation-hidden messages are resolved BEFORE any attachment lookup and answer 409 `ATTACHMENT_UNAVAILABLE` with `details.reason` MESSAGE_DELETED / MESSAGE_HIDDEN for ANY attachment id, revealing nothing about current attachment data. Other closed 409 reasons: NO_REFERENCE, PATH_NOT_BOUND_TO_CONVERSATION, EXTERNAL_HOST_NOT_ALLOWED (legacy references are fetched only from exact HTTPS `cdn.bubble.io` on port 443 with every redirect hop revalidated and bounded), STORAGE_OBJECT_MISSING, EXTERNAL_FETCH_FAILED, OVERSIZE (declared or streamed above the 20 MiB ceiling; the cap is enforced on a trustworthy Content-Length and again while reading). The served `Content-Type` is decided from the BYTES: only verified PNG/JPEG/WebP/GIF signatures are image types; everything else is a forced-download `application/octet-stream` (never active HTML/SVG), always with `X-Content-Type-Options: nosniff`, a sandboxing CSP, `Cache-Control: no-store`, and an RFC 6266 `Content-Disposition: attachment` built from a bounded, control/BiDi-free basename (`filename` ASCII fallback + `filename*`). Every admitted read is audited append-only — the disclosing row (verified byte count, SHA-256, sniffed media type, resolved delivery) is written BEFORE any byte leaves the server; an audit-write failure is a typed 500 with nothing disclosed. The body is a genuinely chunked stream over the verified bytes with NO `Content-Length` (Vercel buffers ordinary responses at 4.5 MiB while streamed responses are exempt); the verified byte count rides `X-OpenTrain-Byte-Size` and the digest `X-OpenTrain-Sha256`. No signed URL, bucket, storage path, or legacy URL is ever disclosed; there is no signed-link mode. Egress is rate-limited at 10/minute on BOTH the token and the client IP (either dimension blocking is a canonical 429 with Retry-After and X-RateLimit-* headers), consumed only AFTER the scope check so unscoped tokens never mutate limiter state. `delivery=auto` is the single-read MCP negotiation mode: after verifying the bytes, the server resolves it to `inline` for PNG/JPEG/WebP/GIF at or below 4 MiB and `resource` otherwise, audits only that resolved successful presentation, and returns it in `X-OpenTrain-Delivery`. Delivery never changes authorization or which bytes are returned.",
        "parameters": [
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Id of a message in a conversation the token can read."
          },
          {
            "name": "attachmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^att_[0-9a-f]{32}$"
            },
            "description": "Opaque attachment id from the message read (`attachments[].attachmentId`). A malformed value is a 400 before authentication."
          },
          {
            "name": "delivery",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "bytes",
                "inline",
                "resource",
                "auto"
              ],
              "default": "bytes"
            },
            "description": "`bytes`, `inline`, or `resource` declares presentation directly. `auto` is the MCP-safe single-read negotiation mode: the server resolves it from verified type/size and reports `inline` or `resource` in X-OpenTrain-Delivery. Strict exact-lowercase enum; empty, unknown, or duplicated values are 400 before authentication."
          }
        ],
        "responses": {
          "200": {
            "description": "The verified attachment bytes as a chunked stream (no Content-Length). Content-Type is the SNIFFED media type; everything that is not a verified PNG/JPEG/WebP/GIF is application/octet-stream.",
            "headers": {
              "Content-Type": {
                "description": "Sniffed media type.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "image/png",
                    "image/jpeg",
                    "image/webp",
                    "image/gif",
                    "application/octet-stream"
                  ]
                }
              },
              "Content-Disposition": {
                "description": "`attachment; filename=\"<ascii>\"; filename*=UTF-8''<encoded>` over the bounded safe basename (or `attachment-<attachmentId>.<ext>`).",
                "schema": {
                  "type": "string"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "nosniff"
                  ]
                }
              },
              "Content-Security-Policy": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "default-src 'none'; sandbox"
                  ]
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              },
              "X-OpenTrain-Message-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OpenTrain-Attachment-Id": {
                "schema": {
                  "type": "string",
                  "pattern": "^att_[0-9a-f]{32}$"
                }
              },
              "X-OpenTrain-Byte-Size": {
                "description": "Verified byte count of the exact body (0..20971520).",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                }
              },
              "X-OpenTrain-Sha256": {
                "description": "Hex SHA-256 of the exact body bytes.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              },
              "X-OpenTrain-Mime-Type": {
                "description": "Same value as Content-Type (the sniffed media type).",
                "schema": {
                  "type": "string"
                }
              },
              "X-OpenTrain-Source": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "PRIVATE_STORAGE",
                    "LEGACY_EXTERNAL"
                  ]
                }
              },
              "X-OpenTrain-Delivery": {
                "description": "Resolved successful presentation. For delivery=auto this is inline for a verified supported raster at or below 4 MiB, otherwise resource.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "bytes",
                    "inline",
                    "resource"
                  ]
                }
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/gif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Missing messageId (reason MESSAGE_ID_REQUIRED), overlong messageId (reason INVALID_MESSAGE_ID), malformed attachmentId (reason INVALID_ATTACHMENT_ID), or invalid/duplicated delivery (reason INVALID_DELIVERY) — all rejected before authentication",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing messages:read scope (the only typed 403)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "ONE opaque response (details.resource 'message_attachment') for a missing message, a foreign message, a conversation you cannot read, a hidden sender, or an unknown attachment id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "ATTACHMENT_UNAVAILABLE with closed details.reason: MESSAGE_DELETED, MESSAGE_HIDDEN, NO_REFERENCE, PATH_NOT_BOUND_TO_CONVERSATION, EXTERNAL_HOST_NOT_ALLOWED, STORAGE_OBJECT_MISSING, EXTERNAL_FETCH_FAILED, or OVERSIZE (audited; nothing disclosed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Egress rate limit exceeded on the token OR the client IP dimension (10/minute each; canonical envelope with Retry-After and X-RateLimit-Limit/Remaining/Reset headers). Consumed only AFTER the scope check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Primary audit write failed: nothing was disclosed (an unaudited disclosure is impossible); retryable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Durable rate-limit dependency outage before any lookup, or private storage transport failure/timeout (audited FETCH_FAILED; distinct from the truthful STORAGE_OBJECT_MISSING data state); retryable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messages/audit": {
      "get": {
        "tags": [
          "messages"
        ],
        "summary": "Audit every conversation for one job (org-level response state)",
        "description": "Requires `messages:read` and employer access to the job. One read covers the job's proposal DMs, Job DMs, and channels: conversation summaries carry the DM counterpart, active/ended contract context, latest activity, and ORGANIZATION-level `needsEmployerReply` — a reply from ANY employer teammate resolves a lane; worker-only threads stay open; a worker follow-up after a teammate reply reopens it; an older unanswered thread keeps its conversation open even after newer top-level employer messages. The cursor-paged `messages` stream returns complete bodies with sender display name/user id/normalized role/employer-organization membership, opaque attachment metadata (`attachments[]`: stable `attachmentId`, name, declared MIME type, size, source, availability — never a signed URL, legacy CDN URL, or storage path; bytes come only from the authenticated, audited attachment read), and per-thread summaries; use `/messages/thread` for full reply bodies. `since`/`until`/`search`/`senderUserId`/`hasAttachments`/`includeThreads` narrow the message stream only — conversation summaries always cover the whole job so filters can never hide an unanswered conversation; `contextType` scopes both. `limit` is 1..100 (default 50); for large jobs, use a smaller page and follow `nextCursor`. Read-only: never creates or mutates conversations.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "senderUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hasAttachments",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "contextType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "proposal_dm",
                "job_dm",
                "channel"
              ]
            }
          },
          {
            "name": "includeThreads",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job communication audit page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or limit; use a smaller page and follow nextCursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or no employer access to the job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job not found (details.reason job_missing)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "SERVICE_UNAVAILABLE: a database dependency was unavailable during lookup (details.retryable true, phase execution, retryAfterSeconds; Retry-After header). Retry the same request after the delay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messages/email-audit": {
      "get": {
        "tags": [
          "Messages"
        ],
        "operationId": "auditNotificationEmails",
        "summary": "Audit notification email evidence for one job",
        "description": "Read-only, messages:read, claimed account and messaging-management rollout. Requires canonical employer job access and current conversation access. Choose 1..50 canonical messageIds, one conversationId plus since/until (maximum 31 days of dispatch observations), or milestoneId with optional recipientUserId. Message IDs are comma-separated in REST query encoding. Follow nextCursor; no implicit send/retry. Missing evidence is unknown, not proof of no send. SENT is provider acceptance; DELIVERED requires an exact primary-recipient event. BCC counts describe the filtered envelope, never review invitation delivery. Historical recipient preferences are not reconstructed. Primary timestamps are event-observation times. Job Operations synchronization is bridged after authorization.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "messageIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "minItems": 1,
              "maxItems": 50,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            },
            "style": "form",
            "explode": false
          },
          {
            "name": "conversationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "milestoneId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "recipientUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Privacy-safe email dispatch observations",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "evidenceId": {
                            "type": "string"
                          },
                          "messageId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "conversationId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "milestoneId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "recipient": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "userId": {
                                "type": "string"
                              },
                              "maskedName": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "userId",
                              "maskedName"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "message.new",
                              "milestone.approved"
                            ]
                          },
                          "emailEligible": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "UNKNOWN",
                              "NOT_ELIGIBLE",
                              "PREFERENCE_DISABLED",
                              "SUPPRESSED",
                              "NOT_ATTEMPTED",
                              "PROCESSING",
                              "SENT",
                              "DELIVERED",
                              "FAILED"
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "RECIPIENT_MISSING",
                              "RECIPIENT_BANNED",
                              "PREFERENCE_DISABLED",
                              "EMAIL_DEFAULT_DISABLED",
                              "RECIPIENT_EXCLUDED",
                              "MISSING_EMAIL",
                              "NO_TEMPLATE",
                              "PRIMARY_RECIPIENT_FAILURE",
                              "ALL_PRIMARY_RECIPIENTS_SUPPRESSED",
                              "DELIVERY_ATTEMPT_FAILED",
                              "MEMBER_REMOVED",
                              "JOB_ACCESS_REMOVED",
                              "CONVERSATION_MUTED",
                              "CONVERSATION_SNOOZED",
                              "ALREADY_READ",
                              "SUPERSEDED",
                              "NOT_TARGETED",
                              "NOTIFICATION_DISABLED",
                              "MESSAGE_UNAVAILABLE",
                              null
                            ]
                          },
                          "observedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "attempt": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "sentAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "primaryDeliveredAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "primaryFailedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "primaryComplainedAt": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "date-time"
                                  },
                                  "recipientCount": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "toCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "ccCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "bccCount": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0
                                  },
                                  "hadBcc": {
                                    "type": [
                                      "boolean",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "createdAt",
                                  "sentAt",
                                  "primaryDeliveredAt",
                                  "primaryFailedAt",
                                  "primaryComplainedAt",
                                  "recipientCount",
                                  "toCount",
                                  "ccCount",
                                  "bccCount",
                                  "hadBcc"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "evidenceId",
                          "messageId",
                          "conversationId",
                          "milestoneId",
                          "recipient",
                          "kind",
                          "emailEligible",
                          "status",
                          "reason",
                          "observedAt",
                          "attempt"
                        ]
                      }
                    },
                    "unobservedMessageIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "unobservedMilestoneId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hasMore": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sync": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/JobOpsSyncEnvelope"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Automatic sync envelope; null when not attached (see syncCoverage for the closed reason)."
                    },
                    "syncCoverage": {
                      "$ref": "#/components/schemas/JobOpsSyncCoverageDiagnostic"
                    }
                  },
                  "required": [
                    "asOf",
                    "jobId",
                    "records",
                    "unobservedMessageIds",
                    "unobservedMilestoneId",
                    "hasMore",
                    "nextCursor",
                    "sync",
                    "syncCoverage"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unbounded selector or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Scope, claim or rollout denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job, conversation, message or milestone not accessible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Evidence or authorization dependency unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/messages/thread": {
      "get": {
        "tags": [
          "messages"
        ],
        "summary": "Read one complete message thread (parent + every reply body)",
        "description": "Requires `messages:read`. Returns the parent plus a chronological reply page with normalized sender roles, visible/deleted/moderated state, timestamps and opaque attachment metadata (never a signed URL or storage path). Follow nextCursor until null; save the last reply ID as cursor to read newer replies later, not edits to earlier messages. Whole-thread latestWorkerReply/latestEmployerReply and ORGANIZATION-level needsEmployerReply describe response evidence, not issue resolution. Page content and freshness.version use one database snapshot. Re-read from the first page and compare version before replying; changes include edits/deletions outside the page. This version is an observation, NOT an atomic send guard. Canonical membership or authorized employer job access grants reads; explicit membership removal and banned-participant hidden state never fall back. Read-only.",
        "parameters": [
          {
            "name": "threadId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Thread detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiMessageThreadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or unknown/cross-thread cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Not a participant / membership removed / hidden conversation (details.reason)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Thread not found (details.reason thread_missing)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "SERVICE_UNAVAILABLE: a database dependency was unavailable during lookup (details.retryable true, phase execution, retryAfterSeconds; Retry-After header). Retry the same request after the delay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/payments/pending": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "List pending payments",
        "description": "Requires `payments:read`. Incomplete invoices visible to the account: funding the employer owes, payouts the freelancer is awaiting. Demo and sample rows are never listed or counted: employer tour fixtures, the docs-demo seed, the DEMO_* credential accounts and the Bubble-era onboarding “Sample Job” engagements are excluded on every agent-facing read, with no opt-in (DEV-2924).",
        "responses": {
          "200": {
            "description": "Pending payments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "payments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/payments/payouts/{invoiceId}/verify": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "Verify current payout provider state",
        "description": "Requires `payments:read` and invoice-party access. Performs a fresh Stripe transfer retrieval and reports live/reversed/missing/mismatched state plus whether OpenTrain disagrees. Strictly read-only; never creates, retries, reverses, or reconciles a transfer.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider-verified payout state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "payout"
                  ],
                  "properties": {
                    "payout": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Payout invoice not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/payments/payouts/{invoiceId}/recovery-preflight": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "Preflight a manual payout recovery",
        "description": "Requires `payments:read` and invoice-party access. Confirms the recorded transfer current state and exhaustively searches Stripe for matching live transfers by destination, amount, currency, and milestone metadata. Strictly read-only; reports whether a human may create one replacement or must reconcile an existing live equivalent.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "approvalId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Payout recovery preflight",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "preflight"
                  ],
                  "properties": {
                    "preflight": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Payout invoice not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Provider state is unavailable or target identity is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/payments/billing-summary": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "Get the buyer billing summary",
        "description": "Requires `payments:read` + the `public_api_credits` feature. One statement view: credit balances, whether a Stripe customer exists, month-to-date spend by kind (milestone funding, data-product purchases, credit top-ups) from the billing-record ledger, and the most recent billing records with a description of what was bought.",
        "responses": {
          "200": {
            "description": "Billing summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "billing"
                  ],
                  "properties": {
                    "billing": {
                      "type": "object",
                      "required": [
                        "credits",
                        "hasStripeCustomer",
                        "currentPeriod",
                        "recentRecords"
                      ],
                      "properties": {
                        "credits": {
                          "type": "object",
                          "required": [
                            "availableCents",
                            "reservedCents",
                            "currency"
                          ],
                          "properties": {
                            "availableCents": {
                              "type": "integer"
                            },
                            "reservedCents": {
                              "type": "integer"
                            },
                            "currency": {
                              "type": "string",
                              "example": "usd"
                            }
                          }
                        },
                        "hasStripeCustomer": {
                          "type": "boolean"
                        },
                        "currentPeriod": {
                          "type": "object",
                          "required": [
                            "periodStartIso",
                            "fundedCents",
                            "dataProductCents",
                            "topUpCents",
                            "recordCount"
                          ],
                          "properties": {
                            "periodStartIso": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "fundedCents": {
                              "type": "integer"
                            },
                            "dataProductCents": {
                              "type": "integer"
                            },
                            "topUpCents": {
                              "type": "integer"
                            },
                            "recordCount": {
                              "type": "integer"
                            }
                          }
                        },
                        "recentRecords": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/BillingRecordSummary"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/payments/billing-settings": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "Get auto-top-up settings",
        "description": "Requires `payments:read` + the `public_api_credits` feature. The buyer auto-reload config: when the balance dips below the threshold, the low-balance sweep (which pages through ALL enabled accounts in bounded, time-budgeted batches — a run that stops on its time budget persists a cursor and the next run resumes there) creates a PENDING reload checkout for the reload amount and notifies the buyer with a one-click payment link — no card is charged off-session; a human completes the checkout.",
        "responses": {
          "200": {
            "description": "Auto-top-up settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "settings"
                  ],
                  "properties": {
                    "settings": {
                      "type": "object",
                      "required": [
                        "autoTopUp"
                      ],
                      "properties": {
                        "autoTopUp": {
                          "$ref": "#/components/schemas/AutoTopUpSettings"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "payments"
        ],
        "summary": "Update auto-top-up settings",
        "description": "Requires `payments:write` + the `public_api_credits` feature. Replaces the auto-reload config; invalid threshold/amount combinations are rejected. Does NOT move money — and enabling auto-top-up does NOT authorize automatic charges: when the sweep (which covers ALL enabled accounts in bounded, time-budgeted batches, resuming from a persisted cursor across runs) later detects a low balance it creates a PENDING reload checkout and notifies the buyer, who completes payment; no off-session card charge happens.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "autoTopUp"
                ],
                "properties": {
                  "autoTopUp": {
                    "$ref": "#/components/schemas/AutoTopUpSettings"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated auto-top-up settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "settings"
                  ],
                  "properties": {
                    "settings": {
                      "type": "object",
                      "required": [
                        "autoTopUp"
                      ],
                      "properties": {
                        "autoTopUp": {
                          "$ref": "#/components/schemas/AutoTopUpSettings"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid auto-top-up settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts": {
      "get": {
        "tags": [
          "contracts"
        ],
        "summary": "List contracts for the token account (bounded page)",
        "description": "Requires `payments:read`. Returns post-hire contracts with independent participationState and settlementState, and accepts exact filters for either state. Demo and sample rows are never listed or counted: employer tour fixtures, the docs-demo seed, the DEMO_* credential accounts and the Bubble-era onboarding “Sample Job” engagements are excluded on every agent-facing read, with no opt-in (DEV-2924). Global reads are bounded keyset pages (limit default 50, max 100); cursors are bound to jobId, status, participationState, settlementState, and asOf. A job-scoped read without limit/cursor remains unpaged. Database-budget overruns return retryable 503 CONTRACT_LIST_TIMEOUT.",
        "parameters": [
          {
            "name": "X-OpenTrain-Features",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opt into additive contract dashboard links with the token `contract-dashboard-url-v1`. Omit for the legacy response shape."
          },
          {
            "name": "jobId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Limit to contracts on one OWNED job. Without limit/cursor this keeps the legacy unpaged read."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "ended"
              ]
            }
          },
          {
            "name": "participationState",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "OFFBOARDING",
                "OFFBOARDED_PAYABLE",
                "CLOSED",
                "REACTIVATED"
              ]
            },
            "description": "Limit to one exact contract participation/access lifecycle state"
          },
          {
            "name": "settlementState",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTION_REQUIRED",
                "PROCESSING",
                "SETTLED"
              ]
            },
            "description": "Limit to one exact earned-payment settlement state"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque `nextCursor` from a previous page; bound to the original filters and asOf (mismatch → 400 CURSOR_FILTER_MISMATCH)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Contracts page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiContractListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid lifecycle/settlement filter, limit below 1, or malformed/mismatched cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "CONTRACT_LIST_TIMEOUT — the read exceeded its database budget; retryable (Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/history": {
      "get": {
        "tags": [
          "contracts"
        ],
        "summary": "Read the canonical engagement history of one contract or proposal",
        "description": "DEV-2830 (`contract_lifecycle.history.get`). Requires `payments:read`. Pass exactly ONE of `contractId` or `proposalId` (both → `BAD_REQUEST` with `details.reason: 'SELECTOR_AMBIGUOUS'`, neither → `'SELECTOR_REQUIRED'`; an unknown `view` → `'INVALID_VIEW'`). Employer-side only: a contract selector authorizes as the contract's hirer or through employer access to its job; a proposal selector authorizes through the proposal's job. Unknown, foreign, candidate-self, and worker-self selectors all read the SAME opaque 404 whose body carries only `details.resource: 'contract_history'` (never the id) — only a missing scope is a 403; infrastructure failures are never disguised as not-found. A contract's proposal reference is used only when that proposal belongs to the contract's own job; a mismatched reference is reported as `PROPOSAL_LINEAGE_MISMATCH` and never exposed. Every contract record is the canonical `/contracts` serializer output (same milestone visibility and payout state). `current.access` derives ONLY from participationState ACTIVE/REACTIVATED and lists every such contract (`ACTIVE` exactly one, `CONFLICT` several, `NONE`); nothing ever picks one contract silently, and the proposal's `HIRED` label is never treated as access (typed warnings report disagreement). `view=current` returns every active record (all of them under CONFLICT), otherwise the latest ended record; `view=timeline` returns every bounded lineage record plus a chronology built ONLY from durable stored timestamps (proposal submitted, contract created/started/reactivated/ended, milestone created with its CURRENT snapshot, audit-backed rehire) — the proposal's current status is observed, never placed in the chronology, and null timestamps are omitted rather than dated. Rehire links and `REHIRE_CREATED` entries come ONLY from `admin_balance.rehire_created` audit rows; a chronological predecessor is never called a rehire. `purpose` comes ONLY from contract-linked work-project evidence (ASSESSMENT | PRODUCTION | UNSPECIFIED with EVIDENCE / NO_EVIDENCE / INCOMPLETE_EVIDENCE / CONFLICTING_EVIDENCE and the observed rows; a contract with more than 50 observations is `evidenceTruncated` and stays UNSPECIFIED — a partial set never classifies). Bounded, no cursor: at most 50 lineage contracts (when the selected contract lies beyond the oldest 50, the oldest 49 plus the selected contract are returned and the warning says so), 200 visible milestones per contract, 500 timeline entries, and 50 purpose evidence rows per contract, each with an explicit `truncated` flag and warning; `asOf` is the read start. Demo and sample rows are never listed or counted: employer tour fixtures, the docs-demo seed, the DEMO_* credential accounts and the Bubble-era onboarding “Sample Job” engagements are excluded on every agent-facing read, with no opt-in (DEV-2924).",
        "parameters": [
          {
            "name": "X-OpenTrain-Features",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opt into additive contract dashboard links with the token `contract-dashboard-url-v1`. Omit for the legacy response shape."
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "description": "Contract selector (exactly one of contractId / proposalId).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "proposalId",
            "in": "query",
            "required": false,
            "description": "Proposal selector (exactly one of contractId / proposalId).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "Defaults to 'current'.",
            "schema": {
              "type": "string",
              "enum": [
                "current",
                "timeline"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Engagement history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContractHistoryGetResponse"
                }
              }
            }
          },
          "400": {
            "description": "Selector mistake: details.reason is 'SELECTOR_REQUIRED', 'SELECTOR_AMBIGUOUS', or 'INVALID_VIEW'",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing payments:read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Unknown, foreign, candidate-self, or worker-self selector (uniform; details carry only resource: 'contract_history', never the id)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}": {
      "get": {
        "tags": [
          "contracts"
        ],
        "summary": "Get contract detail",
        "description": "Requires `payments:read`. Demo and sample rows are never listed or counted: employer tour fixtures, the docs-demo seed, the DEMO_* credential accounts and the Bubble-era onboarding “Sample Job” engagements are excluded on every agent-facing read, with no opt-in (DEV-2924). Adds `jobDmConversationId` — the post-hire direct-message thread usable with `POST /messages` — and a `budget` block (state `OK`/`LOW`/`DEPLETED`, funded vs consumed volume, remaining volume) for hourly and per-label contracts.",
        "parameters": [
          {
            "name": "X-OpenTrain-Features",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opt into additive contract dashboard links with the token `contract-dashboard-url-v1`. Omit for the legacy response shape."
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Contract detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/milestones": {
      "post": {
        "tags": [
          "contracts"
        ],
        "summary": "Create an unfunded milestone",
        "description": "Requires `payments:write` + a claimed account. Creates the milestone directly — no money moves at creation. Fund it afterwards via `POST /milestones/{milestoneId}/fund` (human co-sign).",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "description"
                ],
                "properties": {
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "amountUsd": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "volume": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "dueDate": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created milestone",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Contract is not active",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/milestones/{milestoneId}": {
      "patch": {
        "tags": [
          "contracts"
        ],
        "summary": "Edit an employer milestone without moving money",
        "description": "Requires `payments:write` and a claimed account. The exact contract/milestone binding, `expectedUpdatedAt` revision, and matching `Idempotency-Key` header are required. Name, description, and due date metadata follow the existing milestone edit policy; amount and volume are allowed only before funding on this agent surface. Reuse the same idempotency key only with the identical payload. `moneyMoved` is always false.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "milestoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "idempotencyKey",
                  "expectedUpdatedAt"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "expectedUpdatedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "amountUsd": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "volume": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated milestone",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "milestone",
                    "moneyMoved",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "milestone": {
                      "$ref": "#/components/schemas/PublicApiContractMilestoneRecord"
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid patch, revision, date, or idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract or milestone not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision, ended contract, funded milestone, or key conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/compensation": {
      "post": {
        "tags": [
          "contracts"
        ],
        "operationId": "proposeContractRate",
        "summary": "Propose a new hourly rate for an active contract (worker must accept)",
        "description": "DEV-4500. Requires `payments:write` + the payments-write feature + a claimed account, plus employer access to the contract (owner or job access; denials are non-enumerating 404s). Goes through the SAME worker-consent flow as the web app: records a PENDING compensation change (scope CONTRACT_DEFAULT) with the existing audit event trail, notifies the worker, and the worker accepts or appeals. The contract rate never changes here — only on the worker’s acceptance; existing milestones stay at the current rate. The contract rate at hire defaults to the applicant’s bid unless you pass rateUsd on the hire; a rate different from the bid needs the worker’s acceptance. Hourly (PAY_PER_HOUR) contracts only. The Idempotency-Key header must equal body.idempotencyKey.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "idempotencyKey",
                  "rateUsd"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{8,128}$",
                    "description": "Must equal the Idempotency-Key header."
                  },
                  "rateUsd": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "description": "Proposed rate in USD per hour (1–1000, at most 2 decimals)."
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "Optional note the worker sees with the proposal."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay of a previously recorded proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "jobId",
                    "compensationChange",
                    "workerAcceptanceRequired",
                    "converged",
                    "message",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "compensationChange": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "status",
                        "scope",
                        "paymentType",
                        "perAmountUsd",
                        "previousPaymentType",
                        "previousPerAmountUsd",
                        "note",
                        "proposedAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "ACCEPTED",
                            "DECLINED",
                            "APPEALED",
                            "APPEAL_ACCEPTED",
                            "SUPERSEDED",
                            "CANCELED"
                          ],
                          "description": "PENDING right after the proposal; a same-key retry that resumed a committed proposal reports its CURRENT state."
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "CONTRACT_DEFAULT"
                          ]
                        },
                        "paymentType": {
                          "type": "string"
                        },
                        "perAmountUsd": {
                          "type": "number"
                        },
                        "previousPaymentType": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "previousPerAmountUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "note": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "proposedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "workerAcceptanceRequired": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "converged": {
                      "type": "boolean",
                      "description": "True when the same rate was already pending (or its proposal had committed before a later step failed, or a same-key retry resumed the change it committed) and the existing change was returned without creating or re-sending anything."
                    },
                    "message": {
                      "type": "string"
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Rate proposed (PENDING worker acceptance)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "contractId",
                    "jobId",
                    "compensationChange",
                    "workerAcceptanceRequired",
                    "converged",
                    "message",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "compensationChange": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "status",
                        "scope",
                        "paymentType",
                        "perAmountUsd",
                        "previousPaymentType",
                        "previousPerAmountUsd",
                        "note",
                        "proposedAt"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "ACCEPTED",
                            "DECLINED",
                            "APPEALED",
                            "APPEAL_ACCEPTED",
                            "SUPERSEDED",
                            "CANCELED"
                          ],
                          "description": "PENDING right after the proposal; a same-key retry that resumed a committed proposal reports its CURRENT state."
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "CONTRACT_DEFAULT"
                          ]
                        },
                        "paymentType": {
                          "type": "string"
                        },
                        "perAmountUsd": {
                          "type": "number"
                        },
                        "previousPaymentType": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "previousPerAmountUsd": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "note": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "proposedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "workerAcceptanceRequired": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "converged": {
                      "type": "boolean",
                      "description": "True when the same rate was already pending (or its proposal had committed before a later step failed, or a same-key retry resumed the change it committed) and the existing change was returned without creating or re-sending anything."
                    },
                    "message": {
                      "type": "string"
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid rate, reason, or idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Non-hourly or ended contract, or idempotency-key conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/contracts/{contractId}/end": {
      "post": {
        "tags": [
          "contract-offboarding"
        ],
        "summary": "Compatibility alias for reviewed contract offboarding",
        "description": "Compatibility alias for `/contracts/{contractId}/offboarding/confirm`. Requires the same owner authority, recent reviewed plan token, reason, client idempotency key, and explicit `confirm: true`. Unsettled earned payments never delay access revocation: success is OFFBOARDED_PAYABLE (`lifecycleStatus: CLOSING`), and final CLOSED follows settlement: by itself for an eligible contract when the automatic close is enabled (preflight `automaticClose`), otherwise through the owner close, `POST /contracts/{contractId}/close`.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "idempotencyKey",
                  "reason",
                  "planToken",
                  "confirm"
                ],
                "properties": {
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "planToken": {
                    "type": "string"
                  },
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Offboarding executed (or idempotent replay)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "contractId",
                    "jobId",
                    "status",
                    "participationState",
                    "lifecycleStatus",
                    "settlementState",
                    "contractEnded",
                    "endedAt",
                    "offboardedAt",
                    "moneyMoved",
                    "humanApprovalRequired",
                    "approval",
                    "receipt",
                    "idempotentReplay"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "contractId": {
                      "type": "string"
                    },
                    "jobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "offboarded_payable"
                      ]
                    },
                    "participationState": {
                      "type": "string",
                      "enum": [
                        "OFFBOARDED_PAYABLE"
                      ]
                    },
                    "lifecycleStatus": {
                      "type": "string",
                      "enum": [
                        "CLOSING"
                      ]
                    },
                    "settlementState": {
                      "type": "string",
                      "enum": [
                        "ACTION_REQUIRED",
                        "PROCESSING",
                        "SETTLED"
                      ]
                    },
                    "contractEnded": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "endedAt": {
                      "type": "null"
                    },
                    "offboardedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "humanApprovalRequired": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "approval": {
                      "type": "null"
                    },
                    "receipt": {
                      "type": "object",
                      "required": [
                        "lifecycleState",
                        "finalTimeStatement",
                        "externalRevocations",
                        "projectTodos",
                        "training",
                        "annotationProvider",
                        "messaging",
                        "durableProviderOffboardingJobArmed",
                        "chatMessagesSent",
                        "proposalsModified"
                      ],
                      "properties": {
                        "lifecycleState": {
                          "type": "string",
                          "enum": [
                            "ENDED"
                          ],
                          "description": "Legacy provider/time-offboarding workflow state; this is not final financial closure."
                        },
                        "finalTimeStatement": {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/TimeFinalStatement"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "externalRevocations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "provider",
                              "assignmentId",
                              "status"
                            ],
                            "properties": {
                              "provider": {
                                "type": "string"
                              },
                              "assignmentId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "confirmed_revoked",
                                  "no_revocation_required"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "projectTodos": {
                          "type": "object",
                          "required": [
                            "closedAssignmentIds",
                            "alreadyTerminal"
                          ],
                          "properties": {
                            "closedAssignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "alreadyTerminal": {
                              "type": "integer"
                            }
                          },
                          "additionalProperties": false
                        },
                        "training": {
                          "type": "object",
                          "required": [
                            "closedLmsAssignmentIds"
                          ],
                          "properties": {
                            "closedLmsAssignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "annotationProvider": {
                          "type": "object",
                          "required": [
                            "status",
                            "assignmentIds",
                            "alreadyReleasedAssignmentIds",
                            "pendingManualSteps"
                          ],
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "started_manual_pending",
                                "none"
                              ]
                            },
                            "assignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "alreadyReleasedAssignmentIds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "pendingManualSteps": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "additionalProperties": false
                        },
                        "messaging": {
                          "type": "object",
                          "required": [
                            "channelMembershipsRemoved",
                            "historyPreserved",
                            "jobDmPreserved"
                          ],
                          "properties": {
                            "channelMembershipsRemoved": {
                              "type": "integer"
                            },
                            "historyPreserved": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            },
                            "jobDmPreserved": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            }
                          },
                          "additionalProperties": false
                        },
                        "durableProviderOffboardingJobArmed": {
                          "type": "boolean",
                          "enum": [
                            true
                          ]
                        },
                        "chatMessagesSent": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        },
                        "proposalsModified": {
                          "type": "integer",
                          "enum": [
                            0
                          ]
                        }
                      },
                      "additionalProperties": false
                    },
                    "idempotentReplay": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Missing reason, plan token, idempotency key, or confirm: true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Surface disabled, missing payments:write, not the employer organization owner, or unclaimed agent account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found (unknown or foreign ids are not probeable)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already ended, stale/expired plan, retryable cleanup failure, or idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/milestones/{milestoneId}/fund": {
      "post": {
        "tags": [
          "approvals"
        ],
        "summary": "Request escrow funding for a milestone (human co-sign)",
        "description": "Requires `payments:write` + the `public_api_payments_write` feature + a claimed account. Does NOT move money: records a pending approval and returns `202` with an `approvalUrl` a signed-in human must open and confirm in the OpenTrain app (~72h expiry). Poll `/updates` for `approval.confirmed` or re-check `GET /approvals/{approvalId}`. `409 payment_method_required` includes a `billingUrl`; it is never returned to an Admin Pay actor, who funds with Admin Balance when confirming.",
        "parameters": [
          {
            "name": "milestoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Approval recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalRequest"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Milestone not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Milestone state conflict or payment method required (billingUrl)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/milestones/{milestoneId}/approve": {
      "post": {
        "tags": [
          "approvals"
        ],
        "summary": "Request payment release for a milestone (human co-sign)",
        "description": "Requires `payments:write` + the `public_api_payments_write` feature + a claimed account. Does NOT move money: records a pending approval and returns `202` with an `approvalUrl` a signed-in human must confirm before the milestone payment is released to the freelancer.",
        "parameters": [
          {
            "name": "milestoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Approval recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalRequest"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Milestone not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Milestone is not in a releasable state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/approvals/{approvalId}": {
      "get": {
        "tags": [
          "approvals"
        ],
        "summary": "Get the status of a co-sign approval",
        "description": "Requires `payments:read`. Statuses: `pending` (awaiting human), `confirmed` (human approved; action executed — `result` carries the outcome), `declined`, `expired`.",
        "parameters": [
          {
            "name": "approvalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Approval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "approval"
                  ],
                  "properties": {
                    "approval": {
                      "$ref": "#/components/schemas/Approval"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Approval not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/hub/entries": {
      "get": {
        "tags": [
          "hub"
        ],
        "summary": "List Contributable Hub entries",
        "description": "UNAUTHENTICATED public registry read (available once the hub is generally enabled). Query: type (ENVIRONMENT|DATASET|EVAL|BENCHMARK), source (FEDERATED|OPEN_PUBLISHED|COMMUNITY), q, limit. Held-out benchmark material is never returned — counts and the Merkle commitment only. HF-compatible clients can instead set HF_ENDPOINT to {baseUrl}/hf and use huggingface_hub / datasets directly.",
        "security": [],
        "responses": {
          "200": {
            "description": "Hub entries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Hub not generally enabled yet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "hub"
        ],
        "summary": "Publish a community hub entry",
        "description": "Requires `hub:write`. Creates a COMMUNITY entry in PENDING_REVIEW behind the curation gate; the token user is credited as AUTHOR and earns a portable hub-author credential once listed. License resolves fail-closed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "title",
                  "description",
                  "license"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "ENVIRONMENT",
                      "DATASET",
                      "EVAL",
                      "BENCHMARK"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 160
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "license": {
                    "type": "string"
                  },
                  "readmeMarkdown": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "artifactUrl": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Entry created in PENDING_REVIEW",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entry": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/hub/entries/{slug}": {
      "get": {
        "tags": [
          "hub"
        ],
        "summary": "Get a hub entry",
        "description": "UNAUTHENTICATED public read: attribution + verbatim license, README, versions (commit sha + Merkle commitment), sealed-set counts. Gated entries additionally require an accepted access request for downloads via the /hf resolver.",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Hub entry detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entry": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Entry not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/hub/entries/{slug}/launch": {
      "post": {
        "tags": [
          "hub"
        ],
        "summary": "Resolve a hub entry into a work launch",
        "description": "Requires `hub:read`. The hub never launches work itself ($0-margin): this returns the pre-seeded create-wizard URL for humans and the /label · /evaluate · /environments API hints for machines, after enforcing the license gate. Non-commercial licenses return 409 with the verbatim reason.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Launch target",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "launch": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Entry not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "License blocks commercial launch (verbatim reason)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/hub/entries/{slug}/leaderboard": {
      "get": {
        "tags": [
          "hub"
        ],
        "summary": "Get the human-verified leaderboard",
        "description": "UNAUTHENTICATED public read. Rows carry a verification rung — SELF_REPORTED, AUTOMATED (Merkle-matched sealed run; the measured score replaces the claim), or HUMAN_VERIFIED (blind human re-score corroborated the sealed run; evaluator initials in the evidence). Ordered rung-first, then score. Submit rows via POST /hub/entries/{slug}/leaderboard/rows (`hub:write`); the embeddable badge lives at /hub/{slug}/badge.svg.",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Leaderboard",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "leaderboard": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Entry not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/updates": {
      "get": {
        "tags": [
          "updates"
        ],
        "summary": "Poll the account event delta feed",
        "description": "Single cheap \"what changed\" poll. Returns events visible to the token, ordered by id ascending. Pass the last seen event id as `cursor` to fetch only newer events; persist `nextCursor` between polls. Event visibility is scope-filtered: `proposal.*` needs `proposals:read`; `message.received` needs `messages:read`; `contract.created`, `milestone.status_changed`, `payment.pending`, `approval.confirmed`, `contract.budget_state_changed` need `payments:read`; `open_label.task_stage_changed` needs `jobs:read`; `time_entry.logged` needs `time:read`; `pilot.round_decided` and `eval.*` (graded, completed, gate_failed) need `open-label:read`. Verification lifecycle events (`verification.completed`, `trust.tier_changed`, `verification.recheck_due`) need `verification:read` AND a personal API token: organization-context tokens never see them, matching the worker verification endpoints. Their payloads are verdict-only and typed per event — `verification.completed` matches `VerificationCompletedEventPayload` (record id, kind, status, method, source, and the `verifiedAt`/`expiresAt` validity window — replays keep the original verification time), `trust.tier_changed` matches `TrustTierChangedEventPayload` (`previousTier`, `tier`), and `verification.recheck_due` matches `VerificationRecheckDueEventPayload`. Never evidence or biometric material. Quiz to-do lifecycle events (`project_todo.quiz.assigned`, `.reminder_due`, `.attempt_submitted`, `.grading_required`, `.graded`, `.result_released`, `.passed`, `.failed`, `.todo_completed`) need `project_todos:read`; each is written once per state change in the transaction that commits it (retries and races converge on one event), and its `data` matches the typed `ProjectTodoQuiz*EventPayload` (IDs and states only — never answers, answer keys, rubrics, points or e-mails). Payloads carry IDs only — fetch full resources via their endpoints.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,19}$"
            },
            "description": "Last event id already processed; only newer events are returned."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Event page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "events",
                    "nextCursor",
                    "hasMore"
                  ],
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformEvent"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as cursor on the next poll"
                    },
                    "hasMore": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid cursor or limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token has none of the scopes that grant event visibility",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/credits": {
      "get": {
        "tags": [
          "credits"
        ],
        "summary": "Get the credit balance overview",
        "description": "Requires `payments:read` + the `public_api_credits` feature. Returns the available and reserved (escrow-held) balances plus the most recent ledger entries.",
        "responses": {
          "200": {
            "description": "Credit balance overview",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "credits"
                  ],
                  "properties": {
                    "credits": {
                      "type": "object",
                      "required": [
                        "availableCents",
                        "reservedCents",
                        "currency",
                        "recentEntries"
                      ],
                      "properties": {
                        "availableCents": {
                          "type": "integer",
                          "description": "Spendable balance in cents"
                        },
                        "reservedCents": {
                          "type": "integer",
                          "description": "Balance reserved in escrow holds, in cents"
                        },
                        "currency": {
                          "type": "string",
                          "example": "usd"
                        },
                        "recentEntries": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CreditLedgerEntry"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/credits/ledger": {
      "get": {
        "tags": [
          "credits"
        ],
        "summary": "List credit ledger entries",
        "description": "Requires `payments:read` + the `public_api_credits` feature. Append-only ledger of every credit movement, newest first. Paginate with `cursor`/`nextCursor`.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ledger page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "entries",
                    "nextCursor"
                  ],
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CreditLedgerEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as cursor to fetch the next page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/credits/top-ups": {
      "post": {
        "tags": [
          "credits"
        ],
        "summary": "Create a credit top-up (human pays the checkout link)",
        "description": "Requires `payments:write` + the `public_api_credits` feature + a claimed account (unclaimed accounts get `403` with a `claimUrl`). Creates a pending top-up and returns a Stripe Checkout `checkoutUrl` that a signed-in human must open and pay — this call alone never charges anything. Credits land when the checkout completes; poll `GET /credits/top-ups/{topUpId}` until `status` is `COMPLETED`. Top-ups expire if unpaid (~24h).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amountUsd"
                ],
                "properties": {
                  "amountUsd": {
                    "type": "number",
                    "minimum": 10,
                    "maximum": 10000,
                    "description": "Top-up amount in US dollars ($10–$10,000)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Top-up created (no money has moved yet)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "topUpId",
                    "checkoutUrl",
                    "topUp",
                    "message"
                  ],
                  "properties": {
                    "topUpId": {
                      "type": "string"
                    },
                    "checkoutUrl": {
                      "type": "string",
                      "description": "Stripe Checkout link a signed-in human must open and pay. Share this URL with the human."
                    },
                    "expiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "topUp": {
                      "$ref": "#/components/schemas/CreditTopUp"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid amount (must be $10–$10,000)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/credits/top-ups/{topUpId}": {
      "get": {
        "tags": [
          "credits"
        ],
        "summary": "Get a credit top-up",
        "description": "Requires `payments:read` + the `public_api_credits` feature. Poll after creating a top-up: `PENDING` means the human has not completed checkout yet; `COMPLETED` means credits are available unless `dispute` is present, which means the settled card payment was later disputed and available credits may have been clawed back; `DISPUTED_UNSETTLED` means the card payment was disputed before it settled, so no credits were added. No automatic refund is made, and `dispute` carries the Stripe dispute reference.",
        "parameters": [
          {
            "name": "topUpId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Top-up",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "topUp"
                  ],
                  "properties": {
                    "topUp": {
                      "$ref": "#/components/schemas/CreditTopUp"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Top-up not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/provenance/verify": {
      "post": {
        "tags": [
          "provenance"
        ],
        "summary": "Verify any OpenTrain-signed asset or dataset credential (free)",
        "description": "UNAUTHENTICATED — the free half of the open provenance network (Step 17). Send a C2PA-carrying media asset (multipart `file` or raw bytes + Content-Type; max 25 MB) for a validation report, or JSON `{manifest, jws, publicKeyPem}` to check a dataset credential. OpenTrain-signed media also verifies OFF-platform in any standard C2PA validator.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "manifest",
                  "jws",
                  "publicKeyPem"
                ],
                "properties": {
                  "manifest": {
                    "type": "object"
                  },
                  "jws": {
                    "type": "string"
                  },
                  "publicKeyPem": {
                    "type": "string"
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Unsupported or oversized payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/provenance/attestations/{attestationId}": {
      "get": {
        "tags": [
          "provenance"
        ],
        "summary": "Public attestation registry read (free)",
        "description": "UNAUTHENTICATED. Fetch a BYO-data attestation issued through the partner rail: the standards-mapped manifest, the signed credential (`jws` + `publicKeyPem`), and `credentialValid` (re-verified on every read). The attestation records what was declared and when plus content integrity — it is not a legal conclusion.",
        "security": [],
        "parameters": [
          {
            "name": "attestationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Attestation record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/envs/listings": {
      "get": {
        "tags": [
          "envs"
        ],
        "summary": "Browse certified env listings",
        "description": "Requires `envs:read` + the `public_api_envs` feature. LISTED environments only — every listing passed the certification gauntlet (agent playtest, adversarial reward-hacking probe, paid human review, reproducibility).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Certified listings with public prices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "listings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "priceCents": {
                            "type": "number"
                          },
                          "licenseTier": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          },
                          "packageName": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/envs/listings/{slug}": {
      "get": {
        "tags": [
          "envs"
        ],
        "summary": "Env listing detail + certification report",
        "description": "Requires `envs:read`. The full listing including the public certification report (playtest metrics, adversarial probe, human review verdict, reproducibility, license scan).",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Listing detail with certReport",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Listing not found or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/envs/listings/{slug}/license": {
      "post": {
        "tags": [
          "envs"
        ],
        "summary": "Instant-license an environment",
        "description": "Requires `envs:write`. Instant checkout under the cap ($5k, STANDARD_TRAINING): the price is hold→captured from prepaid credits (`402` = top up first), retry-convergent per (listing, org). Returns the license (manifest-hash-pinned) and the artifact download grant.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "License issued (or converged on the existing one)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "licenseId": {
                      "type": "string"
                    },
                    "priceCents": {
                      "type": "number"
                    },
                    "manifestHash": {
                      "type": "string"
                    },
                    "download": {
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Prepaid credit balance does not cover the price",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, self-purchase, or over-cap/exclusive tier",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Listing not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/envs/trial-sessions": {
      "post": {
        "tags": [
          "envs"
        ],
        "summary": "Start a hosted trial session",
        "description": "Requires `envs:write`. Time-boxed per-session sandbox for a LISTED environment speaking the OpenEnv reset/step/state contract. Demo compute is absorbed under a platform-wide monthly ceiling — expect a refusal when exhausted.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "listingSlug"
                ],
                "properties": {
                  "listingSlug": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Trial session running",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sessionId": {
                      "type": "string"
                    },
                    "endpointUrl": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Trial capacity exhausted or provider unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Listing not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/envs/commissions": {
      "get": {
        "tags": [
          "envs"
        ],
        "summary": "List your env commissions",
        "description": "Requires `envs:read`. The org’s environment-construction commissions.",
        "responses": {
          "200": {
            "description": "Commissions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or no organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "envs"
        ],
        "summary": "Commission a custom environment",
        "description": "Requires `envs:write`. Posts an environment-construction commission: content is moderated, the budget is escrow-held from prepaid credits (`402` = top up first), and a delivery workspace is created. Exclusivity (EXCLUSIVE work-for-hire vs NON_EXCLUSIVE) and mode (SELF_SERVE 10% / MANAGED 20% recorded take) are buyer choices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title",
                  "spec",
                  "budgetUsd"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "spec": {
                    "type": "object",
                    "required": [
                      "domain",
                      "taskFamily"
                    ],
                    "properties": {
                      "domain": {
                        "type": "string"
                      },
                      "taskFamily": {
                        "type": "string"
                      },
                      "difficultyTargets": {
                        "type": "string"
                      },
                      "verifierRequirements": {
                        "type": "string"
                      },
                      "runtimeContract": {
                        "type": "string"
                      }
                    }
                  },
                  "exclusivity": {
                    "type": "string",
                    "enum": [
                      "EXCLUSIVE",
                      "NON_EXCLUSIVE"
                    ]
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "SELF_SERVE",
                      "MANAGED"
                    ]
                  },
                  "budgetUsd": {
                    "type": "number",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Commission posted (budget escrow-held)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "commissionId": {
                      "type": "string"
                    },
                    "deliveryProjectId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Prepaid credit balance does not cover the budget",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or moderation block",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/envs/bounties": {
      "get": {
        "tags": [
          "envs"
        ],
        "summary": "List your env bounties",
        "description": "Requires `envs:read`. The org’s env bounties with submission counts.",
        "responses": {
          "200": {
            "description": "Bounties",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or no organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "envs"
        ],
        "summary": "Post an env bounty",
        "description": "Requires `envs:write`. Posts a competitive env bounty: the pool is escrow-held (`402` = top up first); builders enter VALIDATED packages; you decide the ranked winners (partial awards via awardSplitBps; the remainder releases).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title",
                  "spec",
                  "poolUsd"
                ],
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "spec": {
                    "type": "object",
                    "required": [
                      "domain",
                      "taskFamily"
                    ],
                    "properties": {
                      "domain": {
                        "type": "string"
                      },
                      "taskFamily": {
                        "type": "string"
                      },
                      "verifierRequirements": {
                        "type": "string"
                      }
                    }
                  },
                  "poolUsd": {
                    "type": "number",
                    "minimum": 1
                  },
                  "awardSplitBps": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "Ranked award split in basis points (≤ 10000 total)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounty posted (pool escrow-held)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bountyId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Prepaid credit balance does not cover the pool",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or moderation block",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/envs/certifications/{versionId}": {
      "get": {
        "tags": [
          "envs"
        ],
        "summary": "Read a certification report",
        "description": "Requires `envs:read`. The CERTIFIED report for an env package version — agent playtest, adversarial reward-hacking probe, paid human review verdict, reproducibility, and license scan.",
        "parameters": [
          {
            "name": "versionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Certification report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "No CERTIFIED report for this version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/gigs": {
      "post": {
        "tags": [
          "gigs"
        ],
        "summary": "Dispatch a human gig (agent-native)",
        "description": "Requires `jobs:write` + the `agent_gig_dispatch` feature. An agent dispatches a VERIFY (fact-check), VALIDATE (check an output), JUDGE (compare/pick), or FILL (supply missing data) task to a vetted human. The budget is escrow-held from prepaid credits at dispatch (`402` = top up first) and captured only when independent review accepts the answer. The payload runs the same moderation pipeline as job publishes; routing is automatic to the best-reputation available human.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "gigType",
                  "title",
                  "question",
                  "budgetUsd"
                ],
                "properties": {
                  "gigType": {
                    "type": "string",
                    "enum": [
                      "VERIFY",
                      "VALIDATE",
                      "JUDGE",
                      "FILL"
                    ]
                  },
                  "title": {
                    "type": "string"
                  },
                  "question": {
                    "type": "string",
                    "description": "The task the human answers"
                  },
                  "context": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Background the human needs (sources, the output under test, options)"
                  },
                  "expectedOutput": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "description": "Optional structured expectations echoed to the human"
                  },
                  "budgetUsd": {
                    "type": "number",
                    "minimum": 1,
                    "maximum": 500,
                    "description": "Escrow-held at dispatch, captured on verification ($1–$500)"
                  },
                  "slaSeconds": {
                    "type": "number",
                    "description": "Deadline in seconds (15 minutes to 7 days; default 24h). Expiry releases the hold."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Gig dispatched (budget escrow-held)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GigSummary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid gig type, budget, or SLA",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Prepaid credit balance does not cover the budget — top up first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, moderation block, or spend cap exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/gigs/{gigId}": {
      "get": {
        "tags": [
          "gigs"
        ],
        "summary": "Get a gig and its verified result",
        "description": "Requires `jobs:read` + the `agent_gig_dispatch` feature. Returns the live gig status; the human answer (`result`) and QC signal (`qc`) are present ONLY once the gig is VERIFIED — an answer that has not cleared independent review is never returned. This read also advances the gig lifecycle from the live review state.",
        "parameters": [
          {
            "name": "gigId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Gig with result when VERIFIED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GigResult"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Gig not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/gigs/{gigId}/cancel": {
      "post": {
        "tags": [
          "gigs"
        ],
        "summary": "Cancel a gig before fulfillment",
        "description": "Requires `jobs:write` + the `agent_gig_dispatch` feature. Releases the escrow hold back to the credit balance. `409` once the human has submitted an answer.",
        "parameters": [
          {
            "name": "gigId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Gig cancelled, hold released",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GigSummary"
                }
              }
            }
          },
          "404": {
            "description": "Gig not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already fulfilled — cannot cancel",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agent-account": {
      "get": {
        "tags": [
          "gigs"
        ],
        "summary": "Agent account: balance, spend caps, gig spend",
        "description": "Requires `payments:read` + the `agent_gig_dispatch` feature. The funded-account view an agent checks before dispatching: prepaid credit balance (available + escrow-held), agent spend caps with usage, and gig totals with recent gigs.",
        "responses": {
          "200": {
            "description": "Agent account overview",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "balance",
                    "spendCaps",
                    "gigs",
                    "recentGigs"
                  ],
                  "properties": {
                    "balance": {
                      "type": "object",
                      "description": "The credits overview (same shape as GET /credits)"
                    },
                    "spendCaps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tokenId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "capCents": {
                            "type": "number"
                          },
                          "spentCents": {
                            "type": "number"
                          },
                          "window": {
                            "type": "string",
                            "enum": [
                              "TOTAL",
                              "MONTHLY"
                            ]
                          }
                        }
                      }
                    },
                    "gigs": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "number"
                        },
                        "active": {
                          "type": "number"
                        },
                        "verified": {
                          "type": "number"
                        },
                        "spentCents": {
                          "type": "number"
                        }
                      }
                    },
                    "recentGigs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GigSummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or no organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agent-account/fund": {
      "post": {
        "tags": [
          "gigs"
        ],
        "summary": "Fund the agent credit account (adapter-based)",
        "description": "Requires `payments:write` + the `agent_gig_dispatch` feature. Funds the prepaid credits that gig escrow draws from. Method `stripe_checkout` (default) returns a checkout link a human pays. Method `x402` (SANDBOX; testnet-pinned, enabled per environment) is machine-to-machine per the x402 standard: the first call answers `402` with `accepts` PaymentRequirements; retry with an `X-PAYMENT` header to verify + settle against the facilitator — the ledger records the settlement exactly-once by payment nonce, and the settle receipt returns in `X-PAYMENT-RESPONSE`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amountUsd"
                ],
                "properties": {
                  "amountUsd": {
                    "type": "number",
                    "description": "Top-up amount in US dollars"
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "stripe_checkout",
                      "x402"
                    ],
                    "default": "stripe_checkout"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Funding intent (checkout link pending, or settled)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "method": {
                      "type": "string",
                      "enum": [
                        "stripe_checkout",
                        "x402"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING",
                        "SETTLED"
                      ]
                    },
                    "amountCents": {
                      "type": "number"
                    },
                    "topUpId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "checkoutUrl": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "enabledMethods": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid amount or unavailable funding method",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required — the body carries `accepts` PaymentRequirements to satisfy and retry with X-PAYMENT",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": [
          "webhooks"
        ],
        "summary": "List webhook subscriptions",
        "description": "Requires `webhooks:manage` + the `public_api_webhooks` feature. Secrets are never returned after creation.",
        "responses": {
          "200": {
            "description": "Webhook subscriptions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhooks"
                  ],
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookSubscription"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Create a webhook subscription",
        "description": "Requires `webhooks:manage` + the `public_api_webhooks` feature; each subscribed event type additionally requires its read scope (`proposal.*` → `proposals:read`, `message.received` → `messages:read`, money events → `payments:read`, quiz to-do lifecycle `project_todo.quiz.*` → `project_todos:read`). Verification lifecycle types (`verification.completed`, `trust.tier_changed`, `verification.recheck_due`) require `verification:read` AND a personal API token — an organization-context token receives 403 for them, and webhook management (list/get/delete) is isolated per token context (personal tokens manage personal subscriptions; organization tokens manage that organization’s). Deliveries POST the same PlatformEvent records served by `GET /updates` (IDs only, no message bodies), signed with `X-OpenTrain-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of \"{t}.{rawBody}\">`. Respond 2xx within 10 seconds. New subscriptions start at the current event high-water mark — events that already exist are reachable via `GET /updates` only. Failed deliveries retry up to 5 attempts with backoff (1m/5m/30m/120m); after 10 consecutive exhausted deliveries the subscription is auto-disabled. URLs must be https (plain http is allowed for localhost only). Limit 10 subscriptions per account.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url",
                  "eventTypes"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "HTTPS endpoint that receives deliveries"
                  },
                  "eventTypes": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string"
                    },
                    "description": "Subset of the PlatformEvent type catalog"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook created (secret shown once)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook",
                    "secret",
                    "message"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/WebhookSubscription"
                    },
                    "secret": {
                      "type": "string",
                      "description": "whsec_-prefixed signing secret. Store it now — it is never returned again."
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid url or eventTypes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or missing read scope for a subscribed event type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Subscription limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{webhookId}": {
      "patch": {
        "tags": [
          "webhooks"
        ],
        "summary": "Update a webhook subscription (U105)",
        "description": "Update `url` and/or `eventTypes` WITHOUT rotating the secret — deliveries keep verifying under the existing secret. The full new eventTypes set is re-validated: each type requires its read scope, so added types cannot escalate past the token. Requires `webhooks:manage` + the `public_api_webhooks` feature.",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "anyOf": [
                  {
                    "required": [
                      "url"
                    ]
                  },
                  {
                    "required": [
                      "eventTypes"
                    ]
                  }
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "eventTypes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated subscription. The secret is never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/WebhookSubscription"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Empty update, invalid url, or unsupported event types",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing webhooks:manage, feature disabled, or an added event type requires a read scope the token lacks",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Webhook not found (or not owned in this token context)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Failed to update the webhook subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "webhooks"
        ],
        "summary": "Get a webhook subscription",
        "description": "Requires `webhooks:manage` + the `public_api_webhooks` feature. The secret is never returned.",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook subscription",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/WebhookSubscription"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Webhook not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "webhooks"
        ],
        "summary": "Delete a webhook subscription",
        "description": "Requires `webhooks:manage` + the `public_api_webhooks` feature. Also deletes pending deliveries. Auto-disabled subscriptions are deleted and re-created to resume.",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "webhook",
                    "deleted"
                  ],
                  "properties": {
                    "webhook": {
                      "$ref": "#/components/schemas/WebhookSubscription"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Webhook not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-drafts": {
      "post": {
        "tags": [
          "job-drafts"
        ],
        "summary": "Import a plain-text job description as a draft",
        "description": "Requires `jobs:write` + the `public_api_job_drafting` feature. Parses free text into a normalized draft and returns field-level validation with `publishReady`, plus `applicationScreening` (DEV-4490).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft + validation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "applicationScreening": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Whether applicants take a screening course and quiz before hire (the job’s ACTIVE SCREENING course link). Proposals submitted before the link are not enrolled automatically, so link it before publishing (`POST /lms/jobs/{jobId}/courses/link` with stage SCREENING); `GET /lms/jobs/{jobId}/screening` lists earlier proposals as bindingGaps. `nextCommands` are CLI commands. Null when the read failed; the draft or publish itself still succeeded.",
                      "additionalProperties": false,
                      "required": [
                        "linked",
                        "courseId",
                        "courseTitle",
                        "maxAttempts",
                        "note",
                        "nextCommands"
                      ],
                      "properties": {
                        "linked": {
                          "type": "boolean"
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "courseTitle": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "maxAttempts": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Applicant quiz attempt ceiling; null reads as the platform default (1)."
                        },
                        "note": {
                          "type": "string"
                        },
                        "nextCommands": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-drafts/{jobId}": {
      "patch": {
        "tags": [
          "job-drafts"
        ],
        "summary": "Update draft fields (gap-filling)",
        "description": "Requires `jobs:write` + the `public_api_job_drafting` feature. Patch any subset of draft fields; response returns updated validation. See `GET /capabilities` for accepted fields and enums. Screening configuration fields: `aiInterviewRequired` (true | false | null) and `aiInterviewModality` (`VOICE` | `TEXT`). `warnings` lists UNSUPPORTED_MARKDOWN per field the job page would show literally: jobDescription renders only \"#\"/\"##\"/\"###\" headings, \"-\" or \"1.\" lists and **bold**; every other text field is plain text (DEV-4486).",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated draft + validation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "applicationScreening": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Whether applicants take a screening course and quiz before hire (the job’s ACTIVE SCREENING course link). Proposals submitted before the link are not enrolled automatically, so link it before publishing (`POST /lms/jobs/{jobId}/courses/link` with stage SCREENING); `GET /lms/jobs/{jobId}/screening` lists earlier proposals as bindingGaps. `nextCommands` are CLI commands. Null when the read failed; the draft or publish itself still succeeded.",
                      "additionalProperties": false,
                      "required": [
                        "linked",
                        "courseId",
                        "courseTitle",
                        "maxAttempts",
                        "note",
                        "nextCommands"
                      ],
                      "properties": {
                        "linked": {
                          "type": "boolean"
                        },
                        "courseId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "courseTitle": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "maxAttempts": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "description": "Applicant quiz attempt ceiling; null reads as the platform default (1)."
                        },
                        "note": {
                          "type": "string"
                        },
                        "nextCommands": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Draft not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "job-drafts"
        ],
        "summary": "Discard a never-published draft",
        "description": "Requires `jobs:write` + the `public_api_job_drafting` feature, and an organization owner, like deleting a job in the dashboard (DEV-4485). Soft-deletes a draft that was never published, has no proposals and is in no folder; `GET /jobs` no longer lists it. Repeating the call returns `alreadyDiscarded: true`. A published or previously published job returns 409; close it with `POST /jobs/{id}/close`. A foldered draft returns 409 until it is moved out of its folder in the app.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Draft discarded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "jobId",
                    "status",
                    "alreadyDiscarded"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DELETED"
                      ]
                    },
                    "alreadyDiscarded": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or not an organization owner",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Draft not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Not a never-published draft, in a folder, or a recruiting marketplace job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-drafts/clients": {
      "get": {
        "tags": [
          "job-drafts"
        ],
        "summary": "Valid client ids for admin job drafts",
        "description": "Requires `jobs:read` and an admin account (DEV-4182). Admin accounts must set `msClientId` and `internalJobName` before publishing; this lists the valid client ids. A client with `requiresExternalReferralJobId` also needs `externalReferralJobId`. Regular employer accounts get 403 ADMIN_ONLY because those fields are never required of them.",
        "responses": {
          "200": {
            "description": "Client ids",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "clients",
                    "notes"
                  ],
                  "properties": {
                    "clients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "displayName",
                          "requiresExternalReferralJobId"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "requiresExternalReferralJobId": {
                            "type": "boolean"
                          }
                        }
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, or not an admin account (ADMIN_ONLY)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-drafts/fields": {
      "get": {
        "tags": [
          "job-drafts"
        ],
        "summary": "Reference of every editable draft field",
        "description": "Requires `jobs:read`. Lists every key `PATCH /job-drafts/{jobId}` accepts with its value type, meaning, units, allowed values, text format, and whether the Review-step or publish rules require it (DEV-4480). Static: reads no job data.",
        "responses": {
          "200": {
            "description": "Field reference",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "fields",
                    "notes"
                  ],
                  "properties": {
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "key",
                          "type",
                          "nullable",
                          "description",
                          "publishRequired"
                        ],
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "boolean",
                              "array",
                              "object",
                              "enum"
                            ]
                          },
                          "nullable": {
                            "type": "boolean"
                          },
                          "description": {
                            "type": "string"
                          },
                          "units": {
                            "type": "string"
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "valuesExhaustive": {
                            "type": "boolean"
                          },
                          "format": {
                            "type": "string",
                            "enum": [
                              "plain_text",
                              "markdown_subset"
                            ]
                          },
                          "publishRequired": {
                            "type": "boolean"
                          },
                          "adminOnly": {
                            "type": "boolean"
                          },
                          "computed": {
                            "type": "boolean"
                          },
                          "example": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/job-drafts/capabilities": {
      "get": {
        "tags": [
          "discovery"
        ],
        "deprecated": true,
        "summary": "Capability discovery (deprecated alias)",
        "description": "Deprecated alias of `GET /capabilities`, retained for back-compat. Identical response and ungated behavior, including the read-only `tokenPolicy` block (DEV-2544 K1.2) for bearer calls and `null` for in-app session actors. Prefer `GET /capabilities`.",
        "responses": {
          "200": {
            "description": "Capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "tokenPolicy": {
                      "description": "Identical to `GET /capabilities`: read-only policy discovery for the presented token; `null` for in-app session actors. Never a mutation surface.",
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/PublicApiTokenPolicyDiagnostics"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token/session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/team": {
      "get": {
        "tags": [
          "team"
        ],
        "summary": "List workspace team members",
        "description": "Requires `team:read`.",
        "responses": {
          "200": {
            "description": "Team members",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/team/invites": {
      "post": {
        "tags": [
          "team"
        ],
        "summary": "Invite a team member by email",
        "description": "Requires `team:write` + the `public_api_team` feature + a claimed account.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invite outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or unclaimed account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/delivery/projects/{projectId}": {
      "get": {
        "tags": [
          "delivery"
        ],
        "summary": "AI-PM delivery status for an owned project",
        "description": "Requires `jobs:read`; the token owner must own the project's organization, and the `delivery_orchestration` feature must be enabled for them. Open suggestions (stalled-work reassignments, quality-drift rebalances) with triggering rationale, recent batch-delivery rollups, and 30-day counts. Suggestions are advisory: approval executes in the app's Manager panel through existing assignment controls.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Project not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/delivery/suggestions/{suggestionId}/dismiss": {
      "post": {
        "tags": [
          "delivery"
        ],
        "summary": "Dismiss an open AI-PM suggestion",
        "description": "Requires `jobs:write`; the token owner must own the suggestion's project. Records the ruling in the immutable delivery audit log — the same situation is never re-asked. Approval/execution is not available on the agent plane.",
        "parameters": [
          {
            "name": "suggestionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dismissed suggestion",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Suggestion not found or not open",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time-entries": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "List your reconciled time entries",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature. Returns the token owner's OWN reconciled 10-minute billing cells, oldest first. Filter by contract and UTC work-date range. DEVICE tokens may call this.",
        "parameters": [
          {
            "name": "contractId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive UTC work-date lower bound (YYYY-MM-DD)"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive UTC work-date upper bound (YYYY-MM-DD)"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Time entries page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "entries",
                    "nextCursor"
                  ],
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TimeEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Log a manual time entry",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Logs worker manual time on an own contract (policy must allow manual time; tracking consent required). Memo is mandatory; max 24h per entry; not in the future; not older than 30 days. The entry reconciles into billing cells asynchronously and emits a `time_entry.logged` event to the buyer. Manual time is never payment-protected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contractId",
                  "startedAt",
                  "endedAt",
                  "memo"
                ],
                "properties": {
                  "contractId": {
                    "type": "string"
                  },
                  "startedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "memo": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "workProjectId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Manual entry created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "manualEntry"
                  ],
                  "properties": {
                    "manualEntry": {
                      "$ref": "#/components/schemas/TimeManualEntry"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid interval or missing memo",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, tracking disabled, manual time not allowed, or consent missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time-entries/{entryId}": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "Get one of your reconciled time entries",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature. Own entries only.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Time entry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "entry"
                  ],
                  "properties": {
                    "entry": {
                      "$ref": "#/components/schemas/TimeEntry"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Entry not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "time"
        ],
        "summary": "Update one of your reconciled time entries",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Own entries only. Set/clear the memo and/or flip the status: `EXCLUDED` removes the cell's billing (\"remove time\" — you will not be paid for it); `BILLABLE` undoes a prior exclusion (the reconcile sweep recomputes real billable seconds, so it may land as OVER_LIMIT — `recalculating: true` signals the pending recompute). Refused (409) for invoiced/approval-locked cells, approved weeks, and buyer-DISPUTED cells.",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "memo": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 500,
                    "description": "New memo; empty/null clears it. Omit to leave unchanged."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "EXCLUDED",
                      "BILLABLE",
                      "DISPUTED"
                    ],
                    "description": "Worker: EXCLUDED / BILLABLE (undo). Buyer (contract hirer): DISPUTED (requires note) / BILLABLE (unflag)."
                  },
                  "note": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 500,
                    "description": "Required when a buyer sets DISPUTED."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated time entry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "entry",
                    "recalculating"
                  ],
                  "properties": {
                    "entry": {
                      "$ref": "#/components/schemas/TimeEntry"
                    },
                    "recalculating": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Entry not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Cell locked, invoiced, approved, or disputed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/jobs/{jobId}/reconciliation": {
      "get": {
        "tags": [
          "time"
        ],
        "operationId": "getJobTimeReconciliation",
        "summary": "Bounded job time-provider reconciliation (employer read)",
        "description": "Requires `time:read` PLUS the canonical provider-access authorization: organization OWNER, or a non-removed member with provider access authorized, over the exact ACTIVE org-owned provider mapping. DELIBERATELY NOT behind the `public_api_time_tracking` rollout (DEV-3174): an authorized scoped token can always reconcile. Bounded aggregates and latest-approval projection only — no raw provider payloads, screenshots, window titles, or memos. `pageTotals` cover the current page only and sum safely across pages. Cross-job/cross-tenant reads are non-enumerating 404s; a job-assigned member without provider authorization is a typed 403 with `details.reason: \"PROVIDER_ACCESS_REQUIRED\"`. Filters: `contractId` (must belong to the job; otherwise a non-enumerating 404) and `contractStatus` (`ACTIVE` | `ENDED`; `ENDED` = closed OR endDate <= now, matching the response vocabulary exactly).",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive UTC start date (YYYY-MM-DD)."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive UTC end date (YYYY-MM-DD)."
          },
          {
            "name": "contractId",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Single-contract drill-down; must belong to the job."
          },
          {
            "name": "contractStatus",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ENDED"
              ]
            }
          },
          {
            "name": "includeLms",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "DEV-4494: add the read-only per-worker LMS course projection (assigned job courses, status/progress, latest lesson activity, provider time during vs outside courses) as `lms` on each worker plus a job-level `lms` block. Same scopes, ownership checks and paging; both are omitted (not zeroed) when the job has no LMS courses."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded reconciliation page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "provider",
                    "from",
                    "to",
                    "timezone",
                    "asOf",
                    "source",
                    "pageTotals",
                    "workers",
                    "page"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "HUBSTAFF"
                      ]
                    },
                    "from": {
                      "type": "string",
                      "format": "date"
                    },
                    "to": {
                      "type": "string",
                      "format": "date"
                    },
                    "timezone": {
                      "type": "string",
                      "enum": [
                        "UTC"
                      ]
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "source": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "configured",
                        "externalProjectId",
                        "status",
                        "lastSyncStartedAt",
                        "lastSyncCompletedAt",
                        "lastSyncStatus",
                        "freshness"
                      ],
                      "properties": {
                        "configured": {
                          "type": "boolean"
                        },
                        "externalProjectId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lastSyncStartedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "lastSyncCompletedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "lastSyncStatus": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "freshness": {
                          "type": "string",
                          "enum": [
                            "NOT_CONFIGURED",
                            "PENDING",
                            "FRESH",
                            "STALE"
                          ]
                        }
                      }
                    },
                    "pageTotals": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "workers",
                        "enrolledWorkers",
                        "workersWithActivity",
                        "trackedSeconds",
                        "inputTrackedSeconds",
                        "manualSeconds",
                        "billableSeconds",
                        "activityPct"
                      ],
                      "properties": {
                        "workers": {
                          "type": "integer"
                        },
                        "enrolledWorkers": {
                          "type": "integer"
                        },
                        "workersWithActivity": {
                          "type": "integer"
                        },
                        "trackedSeconds": {
                          "type": "integer"
                        },
                        "inputTrackedSeconds": {
                          "type": "integer"
                        },
                        "manualSeconds": {
                          "type": "integer"
                        },
                        "billableSeconds": {
                          "type": "integer"
                        },
                        "activityPct": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      }
                    },
                    "workers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "contractId",
                          "userId",
                          "displayName",
                          "contractStatus",
                          "enrollment",
                          "evidenceState",
                          "totals",
                          "daily",
                          "latestApproval",
                          "firstActivityAt",
                          "lastActivityAt"
                        ],
                        "properties": {
                          "contractId": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Masked worker name."
                          },
                          "contractStatus": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "ENDED"
                            ]
                          },
                          "enrollment": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "state",
                              "joinedAt",
                              "verifiedAt",
                              "lastCheckedAt"
                            ],
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNENROLLED",
                                  "PENDING",
                                  "ACTIVE",
                                  "REVOKED",
                                  "ERROR",
                                  "UNKNOWN"
                                ]
                              },
                              "joinedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "verifiedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "lastCheckedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            }
                          },
                          "evidenceState": {
                            "type": "string",
                            "enum": [
                              "NOT_CONFIGURED",
                              "SYNC_PENDING",
                              "SYNC_STALE",
                              "CONFIGURATION_ERROR",
                              "UNENROLLED",
                              "ZERO_ACTIVITY",
                              "AVAILABLE"
                            ]
                          },
                          "totals": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "trackedSeconds",
                              "inputTrackedSeconds",
                              "manualSeconds",
                              "billableSeconds",
                              "activityPct"
                            ],
                            "properties": {
                              "trackedSeconds": {
                                "type": "integer"
                              },
                              "inputTrackedSeconds": {
                                "type": "integer"
                              },
                              "manualSeconds": {
                                "type": "integer"
                              },
                              "billableSeconds": {
                                "type": "integer"
                              },
                              "activityPct": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              }
                            }
                          },
                          "daily": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "date",
                                "trackedSeconds",
                                "inputTrackedSeconds",
                                "manualSeconds",
                                "billableSeconds",
                                "activityPct"
                              ],
                              "properties": {
                                "date": {
                                  "type": "string",
                                  "format": "date"
                                },
                                "trackedSeconds": {
                                  "type": "integer"
                                },
                                "inputTrackedSeconds": {
                                  "type": "integer"
                                },
                                "manualSeconds": {
                                  "type": "integer"
                                },
                                "billableSeconds": {
                                  "type": "integer"
                                },
                                "activityPct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              }
                            }
                          },
                          "latestApproval": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": false,
                            "required": [
                              "status",
                              "periodStart",
                              "periodStop",
                              "trackedSeconds",
                              "inputTrackedSeconds",
                              "activityPct",
                              "updatedAt"
                            ],
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "periodStart": {
                                "type": "string"
                              },
                              "periodStop": {
                                "type": "string"
                              },
                              "trackedSeconds": {
                                "type": "integer"
                              },
                              "inputTrackedSeconds": {
                                "type": "integer"
                              },
                              "activityPct": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          },
                          "firstActivityAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "lastActivityAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "lms": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "courses",
                              "latestActivity",
                              "time"
                            ],
                            "description": "Present only with includeLms on a job that has LMS courses. A worker with no course assignment carries an empty courses list.",
                            "properties": {
                              "courses": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "courseId",
                                    "courseTitle",
                                    "courseVersionNumber",
                                    "stage",
                                    "assignmentId",
                                    "assignmentStatus",
                                    "waitingOnRole",
                                    "lifecycle",
                                    "currentLesson",
                                    "progress",
                                    "lastActivity",
                                    "latestAssessment",
                                    "span"
                                  ],
                                  "properties": {
                                    "courseId": {
                                      "type": "string"
                                    },
                                    "courseTitle": {
                                      "type": "string"
                                    },
                                    "courseVersionNumber": {
                                      "type": "integer"
                                    },
                                    "stage": {
                                      "type": "string",
                                      "description": "TRAINING (post-hire) or SCREENING (pre-hire)."
                                    },
                                    "assignmentId": {
                                      "type": "string"
                                    },
                                    "assignmentStatus": {
                                      "type": "string"
                                    },
                                    "waitingOnRole": {
                                      "type": "string"
                                    },
                                    "lifecycle": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "assignedAt",
                                        "activatedAt",
                                        "firstViewedAt",
                                        "submittedAt",
                                        "completedAt"
                                      ],
                                      "properties": {
                                        "assignedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "activatedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "firstViewedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "submittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "completedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        }
                                      }
                                    },
                                    "currentLesson": {
                                      "type": [
                                        "object",
                                        "null"
                                      ],
                                      "additionalProperties": false,
                                      "required": [
                                        "moduleKey",
                                        "moduleTitle",
                                        "lessonKey",
                                        "lessonTitle",
                                        "status"
                                      ],
                                      "properties": {
                                        "moduleKey": {
                                          "type": "string"
                                        },
                                        "moduleTitle": {
                                          "type": "string"
                                        },
                                        "lessonKey": {
                                          "type": "string"
                                        },
                                        "lessonTitle": {
                                          "type": "string"
                                        },
                                        "status": {
                                          "type": "string"
                                        }
                                      }
                                    },
                                    "progress": {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "completedLessons",
                                        "totalLessons",
                                        "percentComplete",
                                        "firstLessonStartedAt",
                                        "mostRecentLessonCompletedAt",
                                        "mostRecentAssessmentSubmittedAt",
                                        "lastActivityAt"
                                      ],
                                      "properties": {
                                        "completedLessons": {
                                          "type": "integer"
                                        },
                                        "totalLessons": {
                                          "type": "integer"
                                        },
                                        "percentComplete": {
                                          "type": [
                                            "integer",
                                            "null"
                                          ],
                                          "description": "Whole-number percent of in-scope lessons completed; null with no lessons."
                                        },
                                        "firstLessonStartedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "mostRecentLessonCompletedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "mostRecentAssessmentSubmittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "lastActivityAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        }
                                      }
                                    },
                                    "lastActivity": {
                                      "type": [
                                        "object",
                                        "null"
                                      ],
                                      "additionalProperties": false,
                                      "required": [
                                        "type",
                                        "occurredAt",
                                        "lessonKey"
                                      ],
                                      "properties": {
                                        "type": {
                                          "type": "string"
                                        },
                                        "occurredAt": {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        "lessonKey": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        }
                                      }
                                    },
                                    "latestAssessment": {
                                      "type": [
                                        "object",
                                        "null"
                                      ],
                                      "additionalProperties": false,
                                      "required": [
                                        "attemptId",
                                        "lessonKey",
                                        "attemptNumber",
                                        "status",
                                        "startedAt",
                                        "submittedAt",
                                        "resultReleasedAt",
                                        "projection"
                                      ],
                                      "properties": {
                                        "attemptId": {
                                          "type": "string"
                                        },
                                        "lessonKey": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "attemptNumber": {
                                          "type": "integer"
                                        },
                                        "status": {
                                          "type": "string"
                                        },
                                        "startedAt": {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        "submittedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "resultReleasedAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        },
                                        "projection": {
                                          "type": [
                                            "object",
                                            "null"
                                          ],
                                          "additionalProperties": false,
                                          "required": [
                                            "state",
                                            "earnedPoints",
                                            "possiblePoints",
                                            "passed"
                                          ],
                                          "properties": {
                                            "state": {
                                              "type": "string"
                                            },
                                            "earnedPoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "possiblePoints": {
                                              "type": [
                                                "number",
                                                "null"
                                              ]
                                            },
                                            "passed": {
                                              "type": [
                                                "boolean",
                                                "null"
                                              ]
                                            }
                                          }
                                        }
                                      }
                                    },
                                    "span": {
                                      "type": [
                                        "object",
                                        "null"
                                      ],
                                      "additionalProperties": false,
                                      "required": [
                                        "startsAt",
                                        "endsAt"
                                      ],
                                      "description": "Course span used for the time split: first lesson start (or first view) until completion. endsAt is null while the course is open; the whole object is null when the worker never opened the course.",
                                      "properties": {
                                        "startsAt": {
                                          "type": "string",
                                          "format": "date-time"
                                        },
                                        "endsAt": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "format": "date-time"
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              "latestActivity": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "additionalProperties": false,
                                "required": [
                                  "courseId",
                                  "assignmentId",
                                  "type",
                                  "occurredAt",
                                  "lessonKey"
                                ],
                                "properties": {
                                  "courseId": {
                                    "type": "string"
                                  },
                                  "assignmentId": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "occurredAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  "lessonKey": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              },
                              "time": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "basis",
                                  "trackedSecondsDuringCourses",
                                  "trackedSecondsOutsideCourses"
                                ],
                                "properties": {
                                  "basis": {
                                    "type": "string",
                                    "enum": [
                                      "COURSE_SPAN"
                                    ]
                                  },
                                  "trackedSecondsDuringCourses": {
                                    "type": "integer",
                                    "description": "Provider tracked seconds in this page’s range overlapping any course span."
                                  },
                                  "trackedSecondsOutsideCourses": {
                                    "type": "integer",
                                    "description": "totals.trackedSeconds minus the seconds during courses."
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "lms": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "courses",
                        "basis",
                        "note",
                        "pageTotals"
                      ],
                      "description": "Present only with includeLms on a job that has LMS courses (active course links or course assignments). Omitted, never zeroed, otherwise.",
                      "properties": {
                        "courses": {
                          "type": "array",
                          "description": "Active job courses (course links), in link order.",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "courseId",
                              "courseTitle",
                              "stage"
                            ],
                            "properties": {
                              "courseId": {
                                "type": "string"
                              },
                              "courseTitle": {
                                "type": "string"
                              },
                              "stage": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "basis": {
                          "type": "string",
                          "enum": [
                            "COURSE_SPAN"
                          ]
                        },
                        "note": {
                          "type": "string",
                          "description": "Honest derivation note for the time split. When a per-page read bound was hit (50 job courses, the 500 most recent course assignments, 50 course versions), it says so; request a smaller page for complete per-worker course data."
                        },
                        "pageTotals": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "workersWithCourses",
                            "trackedSecondsDuringCourses",
                            "trackedSecondsOutsideCourses"
                          ],
                          "properties": {
                            "workersWithCourses": {
                              "type": "integer"
                            },
                            "trackedSecondsDuringCourses": {
                              "type": "integer"
                            },
                            "trackedSecondsOutsideCourses": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "page": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "limit",
                        "hasMore",
                        "nextCursor"
                      ],
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid date range, limit, or contractStatus",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or PROVIDER_ACCESS_REQUIRED (details.reason) for a job-assigned member without provider authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or contract not found / outside your organization (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/jobs/{jobId}/sessions": {
      "get": {
        "tags": [
          "time"
        ],
        "operationId": "listJobTimeSessions",
        "summary": "Bounded session-level provider time evidence (employer read)",
        "description": "Requires `time:read` plus the exact same canonical provider-access authorization as job reconciliation. DELIBERATELY NOT behind the worker time-tracking rollout. Returns bounded session records with masked worker identity, start/stop/duration, input activity, provider project/task, manual/billable/paid/locked state, approval-period projection, stable source identifiers, and sync freshness. Memo is an honest null with `memoAvailability: NOT_CAPTURED_BY_PROVIDER`; screenshots, window titles, and raw provider payloads never cross this boundary. Cross-job/cross-tenant reads are non-enumerating 404s.",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive UTC start date (YYYY-MM-DD)."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Inclusive UTC end date (YYYY-MM-DD)."
          },
          {
            "name": "contractId",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Single-contract drill-down; must belong to the job."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "PAID",
                "UNPAID",
                "LOCKED",
                "UNLOCKED",
                "MANUAL",
                "AUTOMATIC",
                "BILLABLE",
                "NON_BILLABLE"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque pagination cursor from a previous response (nextCursor)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded session evidence page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "provider",
                    "from",
                    "to",
                    "timezone",
                    "asOf",
                    "source",
                    "sessions",
                    "page"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "HUBSTAFF"
                      ]
                    },
                    "from": {
                      "type": "string",
                      "format": "date"
                    },
                    "to": {
                      "type": "string",
                      "format": "date"
                    },
                    "timezone": {
                      "type": "string",
                      "enum": [
                        "UTC"
                      ]
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "source": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "configured",
                        "externalProjectId",
                        "status",
                        "lastSyncStartedAt",
                        "lastSyncCompletedAt",
                        "lastSyncStatus",
                        "freshness"
                      ],
                      "properties": {
                        "configured": {
                          "type": "boolean"
                        },
                        "externalProjectId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lastSyncStartedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "lastSyncCompletedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "lastSyncStatus": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "freshness": {
                          "type": "string",
                          "enum": [
                            "NOT_CONFIGURED",
                            "PENDING",
                            "FRESH",
                            "STALE"
                          ]
                        }
                      }
                    },
                    "sessions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "sessionId",
                          "provider",
                          "contract",
                          "startsAt",
                          "stopsAt",
                          "durationSeconds",
                          "inputTrackedSeconds",
                          "activityPct",
                          "project",
                          "task",
                          "memo",
                          "memoAvailability",
                          "manual",
                          "billable",
                          "paid",
                          "locked",
                          "approval",
                          "source"
                        ],
                        "properties": {
                          "sessionId": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string",
                            "enum": [
                              "HUBSTAFF"
                            ]
                          },
                          "contract": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "userId",
                              "displayName"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Masked worker name."
                              }
                            }
                          },
                          "startsAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "stopsAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "durationSeconds": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "inputTrackedSeconds": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "activityPct": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "project": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "externalId",
                              "name"
                            ],
                            "properties": {
                              "externalId": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "task": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "externalId",
                                  "name"
                                ],
                                "properties": {
                                  "externalId": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "memo": {
                            "type": "null",
                            "description": "Honest null: Hubstaff activity imports do not provide a session memo."
                          },
                          "memoAvailability": {
                            "type": "string",
                            "enum": [
                              "NOT_CAPTURED_BY_PROVIDER"
                            ]
                          },
                          "manual": {
                            "type": "boolean"
                          },
                          "billable": {
                            "type": "boolean"
                          },
                          "paid": {
                            "type": "boolean"
                          },
                          "locked": {
                            "type": "boolean"
                          },
                          "approval": {
                            "oneOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "id",
                                  "status",
                                  "periodStart",
                                  "periodStop",
                                  "updatedAt"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "periodStart": {
                                    "type": "string"
                                  },
                                  "periodStop": {
                                    "type": "string"
                                  },
                                  "updatedAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "externalActivityId",
                              "sourceUpdatedAt",
                              "importedAt"
                            ],
                            "properties": {
                              "externalActivityId": {
                                "type": "string"
                              },
                              "sourceUpdatedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "importedAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    },
                    "page": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "limit",
                        "hasMore",
                        "nextCursor"
                      ],
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid date range, limit, cursor, or status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or PROVIDER_ACCESS_REQUIRED (details.reason) for a job-assigned member without provider authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Job or contract not found / outside your organization (non-enumerating)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/heartbeat": {
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Record a tracking heartbeat",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Extends (or opens) the caller's open capture segment for a contract. DEVICE tokens beat as their paired desktop device; USER tokens beat as the web plane. Returns `{recorded:false, reason}` (not an error) when policy, consent, or ordering blocks the beat.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contractId",
                  "inputActive"
                ],
                "properties": {
                  "contractId": {
                    "type": "string"
                  },
                  "workProjectId": {
                    "type": "string"
                  },
                  "workUnitId": {
                    "type": "string"
                  },
                  "inputActive": {
                    "type": "boolean",
                    "description": "Input presence since the last beat (never content)"
                  },
                  "inputEventsCount": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Heartbeat outcome",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "recorded"
                  ],
                  "properties": {
                    "recorded": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "IDLE"
                      ]
                    },
                    "reason": {
                      "type": "string",
                      "enum": [
                        "no_contract",
                        "tracking_disabled",
                        "consent_required",
                        "stale_beat"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing contractId or inputActive",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or device not active",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/segments": {
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Upload sealed capture segments (paired devices only)",
        "description": "Requires a DEVICE-kind token (`time:write`) + the `public_api_time_tracking` feature — USER tokens get `403 DEVICE_TOKEN_REQUIRED`. Batch upload of sealed capture segments and app/window activity samples (max 500 segments / 2000 samples per request). Timestamps are clock-skew-normalized against `clientNowAt`. Rejections are per-item, replays are deduplicated on client ids, and results are reported per item.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "clientNowAt",
                  "segments"
                ],
                "properties": {
                  "clientNowAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "segments": {
                    "type": "array",
                    "maxItems": 500,
                    "items": {
                      "$ref": "#/components/schemas/TimeSegmentInput"
                    }
                  },
                  "samples": {
                    "type": "array",
                    "maxItems": 2000,
                    "items": {
                      "$ref": "#/components/schemas/TimeActivitySampleInput"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-item ingest results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "clockSkewMs",
                    "segments",
                    "samples"
                  ],
                  "properties": {
                    "clockSkewMs": {
                      "type": "integer"
                    },
                    "segments": {
                      "$ref": "#/components/schemas/TimeIngestBatchResult"
                    },
                    "samples": {
                      "$ref": "#/components/schemas/TimeIngestBatchResult"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Batch cap exceeded or invalid body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "USER token, insufficient scope, feature disabled, or device not active",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/devices": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "List your paired tracking devices",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature.",
        "responses": {
          "200": {
            "description": "Devices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "devices"
                  ],
                  "properties": {
                    "devices": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TimeDevice"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/devices/{deviceId}": {
      "delete": {
        "tags": [
          "time"
        ],
        "summary": "Revoke a paired tracking device",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Revokes the device AND its DEVICE-kind token — capture stops immediately.",
        "parameters": [
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Device revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "device",
                    "revoked"
                  ],
                  "properties": {
                    "device": {
                      "$ref": "#/components/schemas/TimeDevice"
                    },
                    "revoked": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Device not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/devices/pair": {
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Exchange a pairing code for a device token",
        "security": [],
        "description": "UNAUTHENTICATED by design (tightly rate-limited per IP): the desktop app has no token yet. The short-lived single-use 8-character pairing code — minted by the signed-in worker on their Time page — is the credential. Returns a DEVICE-kind token ONCE; it works only on the `/time*` endpoints.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pairingCode",
                  "name",
                  "platform"
                ],
                "properties": {
                  "pairingCode": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string",
                    "description": "Device display name"
                  },
                  "platform": {
                    "type": "string",
                    "enum": [
                      "MACOS",
                      "WINDOWS",
                      "LINUX"
                    ]
                  },
                  "appVersion": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Device paired (token shown once)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "deviceId",
                    "token",
                    "device"
                  ],
                  "properties": {
                    "deviceId": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string",
                      "description": "DEVICE-kind ot_pat_ token. Store it now — never returned again."
                    },
                    "device": {
                      "$ref": "#/components/schemas/TimeDevice"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing pairingCode, name, or platform",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Feature disabled for the code owner",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Pairing code invalid or expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/me": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "Your reconciled time timeline (day + week)",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature. The token owner's own diary for one UTC day plus its surrounding week: per-cell detail, per-day totals, per-contract week totals, and the live open-segment status. Same aggregation as the in-app Time page. DEVICE tokens may call this.",
        "parameters": [
          {
            "name": "dayKey",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "UTC day (YYYY-MM-DD); defaults to today"
          },
          {
            "name": "weekStart",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Any UTC day in the wanted week (used when dayKey is absent)"
          }
        ],
        "responses": {
          "200": {
            "description": "Timeline",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid dayKey/weekStart",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/timesheets": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "List weekly timesheets",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature. Default: the token owner's own timesheets (worker view). Pass `role=buyer` to list timesheets across contracts the token owner hires on. DEVICE tokens cannot call timesheet endpoints.",
        "parameters": [
          {
            "name": "role",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "worker",
                "buyer"
              ]
            },
            "description": "Perspective; defaults to worker"
          },
          {
            "name": "contractId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "SUBMITTED",
                "APPROVED",
                "REJECTED",
                "WITHDRAWN"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Timesheets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Submit a weekly timesheet for review",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Submits the token owner's (contract, UTC-Monday week) of reconciled time for buyer review. `weekStart` accepts any date in the week and normalizes to its UTC Monday; the week must not be in the future and must contain recorded time. Resubmission after rejection/withdrawal reuses the same timesheet.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contractId",
                  "weekStart"
                ],
                "properties": {
                  "contractId": {
                    "type": "string"
                  },
                  "weekStart": {
                    "type": "string",
                    "format": "date"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Submitted timesheet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid week, empty week, or already submitted/approved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/timesheets/{timesheetId}": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "Read one timesheet",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature. Visible to the timesheet's worker and the contract's buyer.",
        "parameters": [
          {
            "name": "timesheetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Timesheet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Timesheet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/timesheets/{timesheetId}/decision": {
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Approve or reject a submitted timesheet (buyer)",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature; the token owner must be the contract's buyer. APPROVE locks the week's reconciled cells (frozen against recompute; no new cells accepted for that contract-week) and snapshots the approved totals. REJECT requires a `note` and reopens the week for the worker to adjust and resubmit. No money moves from this call.",
        "parameters": [
          {
            "name": "timesheetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "decision"
                ],
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "REJECT"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Decided timesheet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid decision, missing rejection note, or not submitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Timesheet not found or not yours to decide",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/timesheets/{timesheetId}/withdraw": {
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Withdraw a submitted timesheet (worker)",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Only the timesheet's worker may withdraw, and only while it is SUBMITTED.",
        "parameters": [
          {
            "name": "timesheetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Withdrawn timesheet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Timesheet is not in a withdrawable state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Timesheet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/screenshots/sign": {
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Sign a screenshot upload (device capture)",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Policy/consent-gated: the contract policy must set screenshots to BLUR or ON, the worker must hold active consent, and the per-cell quota must have room. Returns a short-lived signed storage upload URL plus the mode the client MUST honor (BLUR = blur before upload — a sharp frame never leaves the device). DEVICE tokens may call this.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contractId",
                  "capturedAt"
                ],
                "properties": {
                  "contractId": {
                    "type": "string"
                  },
                  "capturedAt": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Signed upload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or cell quota met",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Screenshots off, consent missing, or insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/screenshots": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "List the worker's own screenshots for a day",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature. The token owner's own screenshots with short-lived signed view URLs — the transparency surface (the worker sees exactly what the buyer sees). DEVICE tokens may call this.",
        "parameters": [
          {
            "name": "dayKey",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "UTC day (YYYY-MM-DD); defaults to today"
          }
        ],
        "responses": {
          "200": {
            "description": "Screenshots",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Record an uploaded screenshot",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Phase 2 of the capture flow: after PUTting the frame to the signed URL, record it. Re-validates policy/consent and the storage path shape; BLUR policies reject unblurred records. DEVICE tokens may call this.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contractId",
                  "capturedAt",
                  "storagePath",
                  "blurred"
                ],
                "properties": {
                  "contractId": {
                    "type": "string"
                  },
                  "capturedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "storagePath": {
                    "type": "string"
                  },
                  "blurred": {
                    "type": "boolean"
                  },
                  "width": {
                    "type": "integer"
                  },
                  "height": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded screenshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, foreign storage path, or blur required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Screenshots off, consent missing, or insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/screenshots/{screenshotId}": {
      "delete": {
        "tags": [
          "time"
        ],
        "summary": "Delete an own screenshot (worker)",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature. Deletion is always the worker's right — and drops the payment protection on that 10-minute cell (the work evidence is gone). DEVICE tokens cannot delete.",
        "parameters": [
          {
            "name": "screenshotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Screenshot not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/me/analytics": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "The worker's own productivity analytics",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature. The token owner's daily tracked/manual/billable/activity series plus top apps by active time (full window-title detail — own data). Range defaults to the trailing 14 days, max 31. DEVICE tokens may call this.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Analytics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/contracts/{contractId}/diary": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "One day of a contract's Work Diary (buyer)",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature and contract ownership (hirer). Upwork-parity Work Diary: per 10-minute cell — screenshots (signed URLs), the activity meter, the worker memo, status incl. the dispute trail, and the full app/window-title/URL usage breakdown (full-visibility rule; the worker sees identical shared data). `day` defaults to today (UTC).",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "day",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Work diary day",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or feature disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/contracts/{contractId}/analytics": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "Contract productivity analytics (either party)",
        "description": "Requires `time:read` + the `public_api_time_tracking` feature; the token owner must be the contract's buyer or worker. Daily series from reconciled cells plus APP-LEVEL usage attributed to the contract by overlapping the worker's activity samples with the contract's tracked cells. Window titles and URLs never appear here — that detail stays on the worker's own analytics. Range defaults to the trailing 14 days, max 31.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Contract analytics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found or not yours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/projects/{projectId}": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "Per-worker attributed hours on an owned project",
        "description": "Requires `time:read` and exact buyer ownership of the project. This bounded buyer reconciliation read is deliberately independent of the `public_api_time_tracking` worker-capture rollout. Returns per-worker tracked/manual/billable seconds + activity for a UTC date range (default last 7 days). Worker identity is masked to \"First L.\" — personal contact details are never returned; screenshots, window titles, and raw provider payloads are not returned.",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Project time summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeWorkerSummaryPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid date range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or not your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Project not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/contracts/{contractId}": {
      "get": {
        "tags": [
          "time"
        ],
        "summary": "Attributed hours on a contract",
        "description": "Requires `time:read` and exact contract-party authorization. This bounded buyer reconciliation read is deliberately independent of the `public_api_time_tracking` worker-capture rollout; the caller must be the contract's hirer or its worker. Same summary shape as the project endpoint, with no screenshots, window titles, or raw provider payloads.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Contract time summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeWorkerSummaryPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid date range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or not your contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/time/contracts/{contractId}/final-statement/finalize": {
      "post": {
        "tags": [
          "time"
        ],
        "summary": "Finalize an immutable final-only provider time statement",
        "description": "Requires `time:write` + the `public_api_time_tracking` feature and contract ownership (hirer). The provider-backed contract must have ended, its locked interval must have settled through a successful post-end provider sync, and the statement must be READY_FOR_REVIEW. Records an audited acknowledgement; never moves money.",
        "parameters": [
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Finalized contract time statement",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contractId",
                    "statement",
                    "moneyMoved"
                  ],
                  "properties": {
                    "contractId": {
                      "type": "string"
                    },
                    "statement": {
                      "$ref": "#/components/schemas/TimeFinalStatement"
                    },
                    "moneyMoved": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Statement is still settling or input is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope, feature disabled, or not the contract hirer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Contract not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/tokens": {
      "get": {
        "tags": [
          "tokens"
        ],
        "summary": "List API tokens for the account",
        "description": "Requires `tokens:read`. Token secrets are never returned after creation.",
        "responses": {
          "200": {
            "description": "Tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "tokens"
        ],
        "summary": "Create an API token",
        "description": "Requires `tokens:write`. Returns the plaintext `ot_pat_` secret once; store it immediately.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created token (secret shown once)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/tokens/{tokenId}": {
      "delete": {
        "tags": [
          "tokens"
        ],
        "summary": "Revoke an API token",
        "description": "Requires `tokens:write`.",
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Token not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ot_pat_…",
        "description": "Personal API token. Existing employer accounts create tokens from Employer Settings -> Developer -> API keys. Agents can also register via POST https://www.opentrain.ai/app/api/agent/identity — see https://www.opentrain.ai/app/auth.md."
      }
    },
    "schemas": {
      "PublicApiAuditSender": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "userId",
          "displayName",
          "role",
          "employerOrganizationMember",
          "isFromViewer"
        ],
        "properties": {
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "freelancer",
              "employer_member",
              "employer_owner",
              "platform_admin",
              "system",
              "unknown"
            ]
          },
          "employerOrganizationMember": {
            "type": "boolean"
          },
          "isFromViewer": {
            "type": "boolean"
          }
        }
      },
      "PublicApiAuditThreadSummary": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "threadId",
          "replyCount",
          "lastReplyAt",
          "needsEmployerReply"
        ],
        "properties": {
          "threadId": {
            "type": "string"
          },
          "replyCount": {
            "type": "integer",
            "minimum": 0
          },
          "lastReplyAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "needsEmployerReply": {
            "type": "boolean"
          }
        }
      },
      "PublicApiAuditMessageRecord": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "conversationId",
          "contextType",
          "threadId",
          "createdAt",
          "updatedAt",
          "editedAt",
          "state",
          "content",
          "messageType",
          "system",
          "sender",
          "attachments",
          "hasAudio",
          "reactionCount",
          "thread"
        ],
        "properties": {
          "videoReference": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "referenceId",
              "assetId",
              "embedPath",
              "durationSeconds",
              "widthPx",
              "heightPx"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "VIDEO_REFERENCE"
                ]
              },
              "referenceId": {
                "type": "string"
              },
              "assetId": {
                "type": "string"
              },
              "embedPath": {
                "type": "string",
                "pattern": "^/api/videos/[^/]+/embed\\?messageId="
              },
              "durationSeconds": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0
              },
              "widthPx": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              },
              "heightPx": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            }
          },
          "id": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "contextType": {
            "type": "string",
            "enum": [
              "proposal_dm",
              "job_dm",
              "channel"
            ]
          },
          "threadId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "editedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "visible",
              "deleted",
              "moderated"
            ]
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          },
          "messageType": {
            "type": [
              "string",
              "null"
            ]
          },
          "system": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "blueText",
                  "greyText"
                ],
                "properties": {
                  "blueText": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "greyText": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "sender": {
            "$ref": "#/components/schemas/PublicApiAuditSender"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiMessageAttachment"
            }
          },
          "hasAudio": {
            "type": "boolean"
          },
          "reactionCount": {
            "type": "integer",
            "minimum": 0
          },
          "thread": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicApiAuditThreadSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PublicApiThreadReplyPointer": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "messageId",
          "senderUserId",
          "createdAt"
        ],
        "properties": {
          "messageId": {
            "type": "string"
          },
          "senderUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicApiMessageThreadFreshness": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "latestReplyId",
          "latestReplyAt",
          "version"
        ],
        "properties": {
          "latestReplyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "latestReplyAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "version": {
            "type": "string"
          }
        },
        "description": "Read observation over the complete authorized thread, including edits/deletions. NOT an atomic send guard. Re-read before replying; a reply is not proof of issue resolution."
      },
      "PublicApiMessageThreadResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "asOf",
          "threadId",
          "conversationId",
          "contextType",
          "jobId",
          "proposalId",
          "needsEmployerReply",
          "parent",
          "replies",
          "replyCount",
          "nextCursor",
          "latestWorkerReply",
          "latestEmployerReply",
          "freshness"
        ],
        "properties": {
          "asOf": {
            "type": "string",
            "format": "date-time"
          },
          "threadId": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "contextType": {
            "type": "string",
            "enum": [
              "proposal_dm",
              "job_dm",
              "channel"
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "needsEmployerReply": {
            "type": "boolean"
          },
          "parent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicApiAuditMessageRecord"
              },
              {
                "type": "null"
              }
            ]
          },
          "replies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiAuditMessageRecord"
            }
          },
          "replyCount": {
            "type": "integer",
            "minimum": 0
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "latestWorkerReply": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicApiThreadReplyPointer"
              },
              {
                "type": "null"
              }
            ]
          },
          "latestEmployerReply": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicApiThreadReplyPointer"
              },
              {
                "type": "null"
              }
            ]
          },
          "freshness": {
            "$ref": "#/components/schemas/PublicApiMessageThreadFreshness"
          }
        }
      },
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "error",
          "code",
          "requestId"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable error message"
          },
          "code": {
            "type": "string",
            "enum": [
              "BAD_REQUEST",
              "UNAUTHORIZED",
              "FORBIDDEN",
              "NOT_FOUND",
              "JOB_CLOSED",
              "CONFLICT",
              "ACCOUNT_STEP_UP_REQUIRED",
              "PAYMENT_REQUIRED",
              "PAYLOAD_TOO_LARGE",
              "NOT_IMPLEMENTED",
              "RATE_LIMITED",
              "AUTHORIZATION_UNAVAILABLE",
              "SERVICE_UNAVAILABLE",
              "INSTRUCTIONS_INVENTORY_TOO_LARGE",
              "INSTRUCTIONS_AGGREGATE_TOO_LARGE",
              "INSTRUCTIONS_DOCUMENT_TOO_LARGE",
              "INSTRUCTIONS_INVENTORY_CHANGED",
              "INSTRUCTIONS_PAGE_CHANGED",
              "INSTRUCTIONS_REVISION_INVALID",
              "INSTRUCTIONS_SCOPE_BUSY",
              "INSTRUCTIONS_PLAN_BLOCKED",
              "INSTRUCTIONS_FOLDER_IMPACT_CONFIRMATION_REQUIRED",
              "INSTRUCTIONS_SOURCE_VERIFICATION_UNAVAILABLE",
              "INSTRUCTIONS_NOT_STAGING",
              "INSTRUCTIONS_DESTINATION_NOT_PLANNED",
              "INSTRUCTIONS_STAGING_READBACK_MISMATCH",
              "INSTRUCTIONS_COMMITTED_READBACK_MISMATCH",
              "INSTRUCTIONS_COMMITTED_READBACK_UNAVAILABLE",
              "INSTRUCTIONS_SOURCE_CHANGED",
              "INSTRUCTIONS_NOT_QUIESCING",
              "INSTRUCTIONS_ROOM_DELETION_CONFLICT",
              "INSTRUCTIONS_ORDER_CAPACITY_EXCEEDED",
              "INSTRUCTIONS_REVERSAL_STATE_CHANGED",
              "INSTRUCTIONS_RECOVERY_UNAVAILABLE",
              "INSTRUCTIONS_RELEASE_DELIVERY_FAILED",
              "IDEMPOTENCY_CONFLICT",
              "OPERATION_UNAVAILABLE",
              "EXECUTOR_NOT_EXPIRED",
              "EXECUTOR_FENCED",
              "OPERATION_TERMINAL",
              "OPERATION_NOT_COMMITTED",
              "SESSION_ASSURANCE_REQUIRED",
              "INVALID_CURSOR",
              "CONTEXT_SNAPSHOT_TIMEOUT",
              "CONTRACT_LIST_TIMEOUT",
              "RENDERER_FAILED",
              "AUTHORING_CONTRADICTION",
              "AUTHORING_ACK_REQUIRED",
              "LIKELY_ESCAPED_NEWLINES",
              "ATTACHMENT_UNAVAILABLE",
              "PARTIAL_MILESTONE_APPROVAL_UNSUPPORTED",
              "PROVIDER_UNAVAILABLE",
              "AUDIT_UNAVAILABLE",
              "INTERNAL_ERROR"
            ]
          },
          "requestId": {
            "type": "string"
          },
          "details": {
            "description": "Endpoint-specific structured context"
          }
        }
      },
      "NewHireOnboardingReceipt": {
        "type": "object",
        "additionalProperties": false,
        "description": "Live new-hire onboarding truth for the contract, recomputed from exact database readback on every response. `status` COMPLETE is the only fully-successful state (every auto-assigned Project To-do exists by exact readback AND the durable onboarding hook settled successfully). PENDING means the durable hook is still queued/running/deferred and has never failed; RETRYABLE_FAILED means an attempt failed or an invariant is unmet and `error.retryable` is true — retry the SAME idempotency key to re-heal and re-check; FAILED is terminal (`error.retryable` false — follow `error.remediation`). Read `GET /project-todos?contractId=` for current assignment truth.",
        "required": [
          "schemaVersion",
          "contractId",
          "jobId",
          "trigger",
          "status",
          "evaluatedAt",
          "requestId",
          "target",
          "assignments",
          "hook",
          "notifications",
          "provisioning",
          "notices",
          "error",
          "healed"
        ],
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "contractId": {
            "type": "string"
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Durable onboarding WorkJob id."
          },
          "trigger": {
            "type": "string",
            "enum": [
              "HIRE_AUTHORIZE",
              "HIRE_ACCEPT",
              "ADMIN_BALANCE_HIRE",
              "ADMIN_BALANCE_REHIRE",
              "APPROVAL_EXECUTE",
              "BULK_HIRE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "PENDING",
              "RETRYABLE_FAILED",
              "FAILED"
            ],
            "description": "RETRYABLE_FAILED ⇔ error.retryable is true (retry the same idempotency key); FAILED is terminal (error.retryable false — follow error.remediation)."
          },
          "evaluatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "requestId": {
            "type": [
              "string",
              "null"
            ]
          },
          "target": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "source",
              "snapshotAt",
              "items"
            ],
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "SNAPSHOT",
                  "COMPLETED_JOB_RESULT",
                  "LIVE_LEGACY"
                ]
              },
              "snapshotAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "itemId",
                    "itemVersionId",
                    "type",
                    "provider",
                    "outcome",
                    "assignmentId",
                    "assignmentStatus",
                    "blockReason"
                  ],
                  "properties": {
                    "itemId": {
                      "type": "string"
                    },
                    "itemVersionId": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "provider": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "PRESENT",
                        "CREATED",
                        "MISSING"
                      ]
                    },
                    "assignmentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignmentStatus": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "blockReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "LMS_LINK_INACTIVE",
                        "LMS_CONFIG_INVALID",
                        null
                      ]
                    }
                  }
                }
              }
            }
          },
          "assignments": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "expectedCount",
              "presentCount",
              "createdCount",
              "createdAssignmentIds",
              "assignmentIds",
              "missingItemIds"
            ],
            "properties": {
              "expectedCount": {
                "type": "integer"
              },
              "presentCount": {
                "type": "integer"
              },
              "createdCount": {
                "type": "integer"
              },
              "createdAssignmentIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "assignmentIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "missingItemIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "hook": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "workJobKey",
              "state",
              "attempts",
              "maxAttempts",
              "nextRunAt",
              "drivenInline",
              "waitedMs"
            ],
            "properties": {
              "workJobKey": {
                "type": "string"
              },
              "state": {
                "type": "string",
                "enum": [
                  "PENDING",
                  "RUNNING",
                  "COMPLETED",
                  "FAILED",
                  "CANCELLED",
                  "MISSING"
                ]
              },
              "attempts": {
                "type": "integer"
              },
              "maxAttempts": {
                "type": "integer"
              },
              "nextRunAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "drivenInline": {
                "type": "boolean"
              },
              "waitedMs": {
                "type": "integer"
              }
            }
          },
          "notifications": {
            "type": "object",
            "additionalProperties": false,
            "description": "Durable outbox state only — never a delivery claim.",
            "required": [
              "expectedCount",
              "queuedCount",
              "sentCount",
              "skippedCount",
              "deadCount"
            ],
            "properties": {
              "expectedCount": {
                "type": "integer"
              },
              "queuedCount": {
                "type": "integer"
              },
              "sentCount": {
                "type": "integer"
              },
              "skippedCount": {
                "type": "integer"
              },
              "deadCount": {
                "type": "integer"
              }
            }
          },
          "provisioning": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "state",
              "counts",
              "providers",
              "retryAfterSeconds"
            ],
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "NOT_REQUIRED",
                  "QUEUED",
                  "RETRYING",
                  "RATE_LIMITED",
                  "DEADLINE_DEFERRED",
                  "FAILED",
                  "COMPLETE"
                ]
              },
              "counts": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "selected",
                  "queued",
                  "providerAccepted",
                  "retrying",
                  "failed",
                  "alreadyExisting"
                ],
                "properties": {
                  "selected": {
                    "type": "integer"
                  },
                  "queued": {
                    "type": "integer"
                  },
                  "providerAccepted": {
                    "type": "integer"
                  },
                  "retrying": {
                    "type": "integer"
                  },
                  "failed": {
                    "type": "integer"
                  },
                  "alreadyExisting": {
                    "type": "integer"
                  }
                }
              },
              "providers": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "retryAfterSeconds": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "notices": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "PROJECT_TODOS_DISABLED",
                "NO_AUTO_ASSIGN_ITEMS",
                "LEGACY_TARGET_FROZEN",
                "LEGACY_TARGET_UNSETTLED",
                "LEGACY_RESULT_ADOPTED",
                "CONTRACT_ENDED_AFTER_ONBOARDING",
                "HOOK_REARMED",
                "HOOK_INSERTED",
                "HOOK_DRIVEN_INLINE",
                "HOOK_DEFERRED_TO_CRON"
              ]
            }
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "code",
              "retryable",
              "retryAfterSeconds",
              "remediation"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "ONBOARDING_CONTRACT_NOT_OPEN",
                  "ONBOARDING_HOOK_FAILED",
                  "ONBOARDING_HOOK_CANCELLED",
                  "ONBOARDING_ASSIGNMENTS_MISSING",
                  "ONBOARDING_PROVISIONING_FAILED",
                  "ONBOARDING_PROVISIONING_RATE_LIMITED",
                  "ONBOARDING_PROVIDER_AUTHORITY_MISSING",
                  "ONBOARDING_TARGET_INVALID",
                  "ONBOARDING_RECONCILE_ERROR"
                ]
              },
              "retryable": {
                "type": "boolean"
              },
              "retryAfterSeconds": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "remediation": {
                "type": "string",
                "enum": [
                  "RETRY_SAME_IDEMPOTENCY_KEY",
                  "RESTORE_PROVIDER_MAPPING",
                  "CONTACT_SUPPORT"
                ]
              }
            }
          },
          "healed": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "rearmed",
              "createdCount"
            ],
            "properties": {
              "rearmed": {
                "type": "boolean"
              },
              "createdCount": {
                "type": "integer"
              }
            }
          }
        }
      },
      "PublicApiMessageAttachment": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "attachmentId",
          "name",
          "mimeType",
          "sizeBytes",
          "source",
          "availability",
          "unavailableReason",
          "retrieval",
          "scanStatus"
        ],
        "properties": {
          "attachmentId": {
            "type": "string",
            "pattern": "^att_[0-9a-f]{32}$"
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 200,
            "description": "Safe display basename derived from the recorded upload name; path components and control/bidi characters are removed."
          },
          "mimeType": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "pattern": "^[a-z0-9][a-z0-9!#$&^_.+*-]*/[a-z0-9][a-z0-9!#$&^_.+*-]*$",
            "description": "Syntactically valid declared upload type; never trusted for delivery. Invalid metadata reads as null."
          },
          "sizeBytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "source": {
            "type": "string",
            "enum": [
              "PRIVATE_STORAGE",
              "LEGACY_EXTERNAL",
              "NONE"
            ]
          },
          "availability": {
            "type": "string",
            "enum": [
              "AVAILABLE",
              "UNAVAILABLE"
            ]
          },
          "unavailableReason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "NO_REFERENCE",
              "PATH_NOT_BOUND_TO_CONVERSATION",
              "EXTERNAL_HOST_NOT_ALLOWED",
              "MESSAGE_DELETED",
              "MESSAGE_HIDDEN",
              "STORAGE_OBJECT_MISSING",
              "EXTERNAL_FETCH_FAILED",
              "OVERSIZE",
              null
            ]
          },
          "retrieval": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "bytes",
              "inlineImageCandidate"
            ],
            "properties": {
              "bytes": {
                "type": "boolean"
              },
              "inlineImageCandidate": {
                "type": "boolean"
              }
            }
          },
          "scanStatus": {
            "type": "string",
            "enum": [
              "NOT_SCANNED"
            ]
          }
        }
      },
      "MessageVideoReference": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "referenceId",
          "assetId",
          "embedPath",
          "durationSeconds",
          "widthPx",
          "heightPx"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "VIDEO_REFERENCE"
            ]
          },
          "referenceId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "embedPath": {
            "type": "string",
            "pattern": "^/api/videos/[^/]+/embed\\?messageId="
          },
          "durationSeconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "widthPx": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "heightPx": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          }
        }
      },
      "PublicApiMessageDelivery": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "rawSha256",
          "canonicalSha256",
          "storedSha256",
          "exactRawMatch",
          "canonicalMatch",
          "warnings",
          "replayed"
        ],
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "rawSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "canonicalSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "storedSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "exactRawMatch": {
            "type": "boolean"
          },
          "canonicalMatch": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "code",
                "message",
                "occurrences"
              ],
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "CANONICAL_TRIM_APPLIED",
                    "CRLF_LINE_ENDINGS",
                    "LITERAL_ESCAPES_ALLOWED"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "occurrences": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "ProjectTodoJsonValue": {
        "description": "Recursive JSON value: string, number, boolean, null, array of values, or a string-keyed object of values.",
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectTodoJsonValue"
            }
          },
          {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/ProjectTodoJsonValue"
            }
          }
        ]
      },
      "ProjectTodoQuizCoachingManageRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "action",
              "idempotencyKey",
              "assignmentId",
              "questionId",
              "attemptId",
              "bodyDoc"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_comment"
                ]
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 8,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:-]+$"
              },
              "assignmentId": {
                "type": "string"
              },
              "questionId": {
                "type": "string"
              },
              "attemptId": {
                "type": "string"
              },
              "bodyDoc": {
                "$ref": "#/components/schemas/ProjectTodoJsonValue"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "idempotencyKey",
              "assignmentId",
              "requestedQuestionIds"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_redo_selection"
                ]
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 8,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:-]+$"
              },
              "assignmentId": {
                "type": "string"
              },
              "requestedQuestionIds": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "idempotencyKey",
              "assignmentId",
              "reviewCycleId"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_draft_cancel"
                ]
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 8,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:-]+$"
              },
              "assignmentId": {
                "type": "string"
              },
              "reviewCycleId": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "NO-WRITE preview — read-scoped and deliberately keyless.",
            "required": [
              "action",
              "assignmentId",
              "reviewCycleId",
              "reason",
              "expectedSubmittedAt"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_send_back_plan"
                ]
              },
              "assignmentId": {
                "type": "string"
              },
              "reviewCycleId": {
                "type": "string"
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "expectedSubmittedAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "idempotencyKey",
              "assignmentId",
              "reviewCycleId",
              "reason",
              "expectedSubmittedAt",
              "planToken"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_send_back_confirm"
                ]
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 8,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:-]+$"
              },
              "assignmentId": {
                "type": "string"
              },
              "reviewCycleId": {
                "type": "string"
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "expectedSubmittedAt": {
                "type": "string",
                "format": "date-time"
              },
              "planToken": {
                "type": "string",
                "minLength": 16,
                "maxLength": 8192
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "idempotencyKey",
              "assignmentId",
              "threadId"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_thread_resolve",
                  "coaching_thread_reopen"
                ]
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 8,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:-]+$"
              },
              "assignmentId": {
                "type": "string"
              },
              "threadId": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "idempotencyKey",
              "assignmentId",
              "expectedSubmittedAt"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_accept"
                ]
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 8,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:-]+$"
              },
              "assignmentId": {
                "type": "string"
              },
              "expectedSubmittedAt": {
                "type": "string",
                "format": "date-time"
              },
              "acknowledgeOpenThreads": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        ],
        "discriminator": {
          "propertyName": "action"
        }
      },
      "ProjectTodoQuizCoachingManageResponse": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "action",
              "commentId",
              "threadId",
              "publishedImmediately",
              "replayed",
              "reviewCycle"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_comment"
                ]
              },
              "commentId": {
                "type": "string"
              },
              "threadId": {
                "type": "string"
              },
              "publishedImmediately": {
                "type": "boolean"
              },
              "replayed": {
                "type": "boolean"
              },
              "reviewCycle": {
                "type": [
                  "object",
                  "null"
                ],
                "required": [
                  "id",
                  "status",
                  "cycleNumber",
                  "requestedQuestionIds"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "OPEN",
                      "RESUBMITTED",
                      "CLOSED"
                    ]
                  },
                  "cycleNumber": {
                    "type": "integer"
                  },
                  "requestedQuestionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "cycle",
              "replayed"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_redo_selection",
                  "coaching_draft_cancel"
                ]
              },
              "cycle": {
                "type": "object",
                "required": [
                  "reviewCycleId",
                  "cycleNumber",
                  "status",
                  "sourceAttemptId",
                  "requestedQuestionIds",
                  "reason",
                  "sentAt",
                  "closedAt",
                  "closedReason"
                ],
                "properties": {
                  "reviewCycleId": {
                    "type": "string"
                  },
                  "cycleNumber": {
                    "type": "integer"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "OPEN",
                      "RESUBMITTED",
                      "CLOSED"
                    ]
                  },
                  "sourceAttemptId": {
                    "type": "string"
                  },
                  "requestedQuestionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sentAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "closedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "closedReason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "ACCEPTED",
                      "GRADED",
                      "SUPERSEDED",
                      "CANCELLED",
                      null
                    ]
                  }
                },
                "additionalProperties": false
              },
              "replayed": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "threadId",
              "status",
              "resolvedAt",
              "replayed"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_thread_resolve",
                  "coaching_thread_reopen"
                ]
              },
              "threadId": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "OPEN",
                  "RESOLVED"
                ]
              },
              "resolvedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "replayed": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "assignmentId",
              "assignmentStatus",
              "waitingOnRole",
              "acknowledgedOpenThreadIds"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_accept"
                ]
              },
              "assignmentId": {
                "type": "string"
              },
              "assignmentStatus": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "OPEN",
                  "IN_PROGRESS",
                  "SUBMITTED",
                  "COMPLETED",
                  "RETURNED",
                  "WAIVED",
                  "CLOSED",
                  "SUPERSEDED",
                  null
                ]
              },
              "waitingOnRole": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "WORKER",
                  "EMPLOYER",
                  "NONE",
                  null
                ]
              },
              "acknowledgedOpenThreadIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "ok",
              "findings",
              "assignmentId",
              "jobId",
              "contractId",
              "cycle",
              "requestedQuestions",
              "draftCommentCount",
              "reason",
              "expectedSubmittedAt",
              "deadline",
              "effects",
              "planToken",
              "planExpiresAt",
              "note"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_send_back_plan"
                ]
              },
              "ok": {
                "type": "boolean"
              },
              "findings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "reason",
                    "message"
                  ],
                  "properties": {
                    "reason": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "assignmentId": {
                "type": "string"
              },
              "jobId": {
                "type": "string"
              },
              "contractId": {
                "type": "string"
              },
              "cycle": {
                "type": "object",
                "required": [
                  "reviewCycleId",
                  "cycleNumber",
                  "status",
                  "sourceAttemptId",
                  "requestedQuestionIds",
                  "reason",
                  "sentAt",
                  "closedAt",
                  "closedReason"
                ],
                "properties": {
                  "reviewCycleId": {
                    "type": "string"
                  },
                  "cycleNumber": {
                    "type": "integer"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "OPEN",
                      "RESUBMITTED",
                      "CLOSED"
                    ]
                  },
                  "sourceAttemptId": {
                    "type": "string"
                  },
                  "requestedQuestionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sentAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "closedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "closedReason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "ACCEPTED",
                      "GRADED",
                      "SUPERSEDED",
                      "CANCELLED",
                      null
                    ]
                  }
                },
                "additionalProperties": false
              },
              "requestedQuestions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "questionId",
                    "prompt"
                  ],
                  "properties": {
                    "questionId": {
                      "type": "string"
                    },
                    "prompt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              },
              "draftCommentCount": {
                "type": "integer"
              },
              "reason": {
                "type": "string"
              },
              "expectedSubmittedAt": {
                "type": "string",
                "format": "date-time"
              },
              "deadline": {
                "type": "object",
                "required": [
                  "dueAt",
                  "blockAt",
                  "overdue",
                  "dueSoon"
                ],
                "properties": {
                  "dueAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "blockAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "overdue": {
                    "type": "boolean"
                  },
                  "dueSoon": {
                    "type": "boolean"
                  },
                  "inheritedUnchanged": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              },
              "effects": {
                "type": "object",
                "required": [
                  "configuredAttemptImpact",
                  "resultingAssignmentStatus",
                  "resultingWaitingRole",
                  "notifications",
                  "publishesDraftBatch"
                ],
                "properties": {
                  "configuredAttemptImpact": {
                    "type": "integer"
                  },
                  "resultingAssignmentStatus": {
                    "type": "string",
                    "enum": [
                      "RETURNED"
                    ]
                  },
                  "resultingWaitingRole": {
                    "type": "string",
                    "enum": [
                      "WORKER"
                    ]
                  },
                  "notifications": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "publishesDraftBatch": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              },
              "planToken": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "planExpiresAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "note": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": [
              "action",
              "assignmentId",
              "assignmentStatus",
              "waitingOnRole",
              "cycle",
              "replayed"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "coaching_send_back_confirm"
                ]
              },
              "assignmentId": {
                "type": "string"
              },
              "assignmentStatus": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "OPEN",
                  "IN_PROGRESS",
                  "SUBMITTED",
                  "COMPLETED",
                  "RETURNED",
                  "WAIVED",
                  "CLOSED",
                  "SUPERSEDED",
                  null
                ]
              },
              "waitingOnRole": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "WORKER",
                  "EMPLOYER",
                  "NONE",
                  null
                ]
              },
              "cycle": {
                "type": [
                  "object",
                  "null"
                ],
                "required": [
                  "reviewCycleId",
                  "cycleNumber",
                  "status",
                  "sourceAttemptId",
                  "requestedQuestionIds",
                  "reason",
                  "sentAt",
                  "closedAt",
                  "closedReason"
                ],
                "properties": {
                  "reviewCycleId": {
                    "type": "string"
                  },
                  "cycleNumber": {
                    "type": "integer"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "OPEN",
                      "RESUBMITTED",
                      "CLOSED"
                    ]
                  },
                  "sourceAttemptId": {
                    "type": "string"
                  },
                  "requestedQuestionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sentAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "closedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "closedReason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "ACCEPTED",
                      "GRADED",
                      "SUPERSEDED",
                      "CANCELLED",
                      null
                    ]
                  }
                },
                "additionalProperties": false
              },
              "replayed": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        ],
        "discriminator": {
          "propertyName": "action"
        }
      },
      "ProjectTodoQuizAssignedEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.assigned`: the quiz to-do assignment was created and bound to its published version (once per assignment).",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "completionPolicy"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "completionPolicy": {
            "type": "string",
            "enum": [
              "ON_SUBMIT",
              "ON_REVIEW",
              "ON_PASS"
            ]
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizReminderDueEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.reminder_due`: an open quiz to-do became eligible for a worker reminder (deadline inside a due-soon window, overdue, or a required no-deadline to-do still unopened). Once per reminder cadence bucket.",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "reminderKind",
          "dueAt",
          "cadenceBucket"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "reminderKind": {
            "type": "string",
            "enum": [
              "DUE_SOON",
              "OVERDUE",
              "UNVIEWED"
            ]
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cadenceBucket": {
            "type": "string",
            "description": "The cadence bucket (`h24`, `h2`, `d3`, `p3-1`, unviewed `d2`, …)."
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizAttemptSubmittedEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.attempt_submitted`: the worker submitted an attempt (once per attempt). `gradeState` is GRADED when every scored question already has a grade.",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "attemptId",
          "attemptNumber",
          "attemptKind",
          "reviewCycleId",
          "gradeState",
          "resultReleased"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "attemptId": {
            "type": "string"
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 1
          },
          "attemptKind": {
            "type": "string",
            "enum": [
              "FULL",
              "REMEDIATION"
            ]
          },
          "reviewCycleId": {
            "type": [
              "string",
              "null"
            ]
          },
          "gradeState": {
            "type": "string",
            "enum": [
              "GRADED",
              "PENDING_MANUAL"
            ]
          },
          "resultReleased": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizGradingRequiredEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.grading_required`: a submitted attempt waits on an employer grade for manually graded questions (once per attempt).",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "attemptId",
          "attemptNumber",
          "pendingQuestionCount"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "attemptId": {
            "type": "string"
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 1
          },
          "pendingQuestionCount": {
            "type": "integer",
            "minimum": 1
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizGradedEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.graded`: a grade revision committed (once per revision). PARTIAL leaves scored questions ungraded; FINALIZED grades every one. `outcome` is null while PARTIAL or without a pass rule.",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "attemptId",
          "attemptNumber",
          "revisionNumber",
          "gradeState",
          "outcome",
          "afterRelease"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "attemptId": {
            "type": "string"
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 1
          },
          "revisionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "gradeState": {
            "type": "string",
            "enum": [
              "PARTIAL",
              "FINALIZED"
            ]
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PASSED",
              "FAILED",
              null
            ]
          },
          "afterRelease": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizResultReleasedEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.result_released`: the result became visible to the worker (once per attempt).",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "attemptId",
          "attemptNumber",
          "releaseMode",
          "releasedAt"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "attemptId": {
            "type": "string"
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 1
          },
          "releaseMode": {
            "type": "string",
            "enum": [
              "IMMEDIATE",
              "MANUAL"
            ]
          },
          "releasedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizOutcomeEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.passed` and `project_todo.quiz.failed`: the attempt’s pass/fail outcome was decided or changed (quizzes with a pass rule only) — once by the automatic grade at submit (`revisionNumber` null), then once per grade revision that flips it.",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "attemptId",
          "attemptNumber",
          "revisionNumber",
          "previousOutcome"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "attemptId": {
            "type": "string"
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 1
          },
          "revisionNumber": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "previousOutcome": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PASSED",
              "FAILED",
              null
            ]
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizTodoCompletedEventPayload": {
        "type": "object",
        "description": "Payload for `project_todo.quiz.todo_completed`: the quiz to-do assignment reached COMPLETED (once per completing transition). `attemptId` is null for an employer approval.",
        "required": [
          "assignmentId",
          "bindingId",
          "formId",
          "formVersionId",
          "completedVia",
          "attemptId"
        ],
        "properties": {
          "assignmentId": {
            "type": "string",
            "description": "The quiz to-do assignment (= `resourceId`)."
          },
          "bindingId": {
            "type": "string",
            "description": "The immutable quiz binding of the assignment."
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string",
            "description": "The bound published quiz version."
          },
          "completedVia": {
            "type": "string",
            "enum": [
              "SUBMISSION",
              "PASS",
              "EMPLOYER_APPROVAL"
            ]
          },
          "attemptId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "ProjectTodoQuizAssignedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.assigned"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizAssignedEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizReminderDueEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.reminder_due"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizReminderDueEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizAttemptSubmittedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.attempt_submitted"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizAttemptSubmittedEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizGradingRequiredEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.grading_required"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizGradingRequiredEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizGradedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.graded"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizGradedEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizResultReleasedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.result_released"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizResultReleasedEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizPassedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.passed"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizOutcomeEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizFailedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.failed"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizOutcomeEventPayload"
              }
            }
          }
        ]
      },
      "ProjectTodoQuizTodoCompletedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "project_todo.quiz.todo_completed"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/ProjectTodoQuizTodoCompletedEventPayload"
              }
            }
          }
        ]
      },
      "InstructionDocNode": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1
          },
          "attrs": {
            "type": "object",
            "additionalProperties": true
          },
          "marks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "minLength": 1
                },
                "attrs": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "text": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InstructionDocNode"
            }
          }
        }
      },
      "JobInstructionDoc": {
        "allOf": [
          {
            "$ref": "#/components/schemas/InstructionDocNode"
          },
          {
            "type": "object",
            "required": [
              "type",
              "content"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "doc"
                ]
              },
              "content": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InstructionDocNode"
                }
              }
            }
          }
        ]
      },
      "JobInstructionDocument": {
        "type": "object",
        "required": [
          "schemaVersion",
          "doc",
          "checksum"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": [
              "opentrain-job-tiptap/1"
            ]
          },
          "doc": {
            "$ref": "#/components/schemas/JobInstructionDoc"
          },
          "checksum": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "JobInstructionLocation": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "employerUrl",
          "instructionSetId",
          "folderInstructionSetId",
          "folderScopeId",
          "managedAt",
          "writeLockedReason"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "employerUrl": {
            "type": "string",
            "format": "uri"
          },
          "instructionSetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "folderInstructionSetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "folderScopeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "managedAt": {
            "type": "string",
            "enum": [
              "JOB",
              "FOLDER"
            ]
          },
          "writeLockedReason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobInstructionPageSummary": {
        "type": "object",
        "required": [
          "id",
          "instructionSetId",
          "parentPageId",
          "title",
          "shareUrl",
          "sortOrder",
          "editable",
          "inherited",
          "managedAt",
          "contentSchemaVersion",
          "children"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "instructionSetId": {
            "type": "string"
          },
          "parentPageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "shareUrl": {
            "type": "string",
            "format": "uri",
            "description": "Canonical actor-aware URL for this exact page. It preserves normal employer/worker authorization and is not public."
          },
          "sortOrder": {
            "type": "integer"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bounded page-identity icon: 'emoji:<glyph>' (single emoji grapheme) or 'lucide:<curated-name>'. Null renders the default document icon."
          },
          "editable": {
            "type": "boolean"
          },
          "inherited": {
            "type": "boolean"
          },
          "managedAt": {
            "type": "string",
            "enum": [
              "JOB",
              "FOLDER"
            ]
          },
          "contentSchemaVersion": {
            "type": "integer",
            "description": "The highest content-schema node set this page’s canonical document may contain (1 = original node set, 2 adds details/callout/youtube/audio/attachment). Upgrade v1 pages via POST /instructions/jobs/{jobId}/pages/{pageId}/schema-upgrade."
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionPageSummary"
            }
          }
        }
      },
      "JobInstructionsInspectResponse": {
        "type": "object",
        "required": [
          "location",
          "hasInstructions",
          "pages"
        ],
        "properties": {
          "location": {
            "$ref": "#/components/schemas/JobInstructionLocation"
          },
          "hasInstructions": {
            "type": "boolean"
          },
          "pages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionPageSummary"
            }
          }
        }
      },
      "JobInstructionCapabilitiesResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "apiVersion",
          "schemaVersion",
          "maxTreeDepth",
          "maxDocumentBytes",
          "maxPatchOperations",
          "allowedNodeTypes",
          "allowedMarkTypes",
          "stableIdNodeTypes",
          "patchOperations",
          "image",
          "imports",
          "mutations",
          "localBundles",
          "pageLinks"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "apiVersion": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "string",
            "enum": [
              "opentrain-job-tiptap/1"
            ]
          },
          "maxTreeDepth": {
            "type": "integer",
            "enum": [
              2
            ]
          },
          "maxDocumentBytes": {
            "type": "integer",
            "minimum": 1
          },
          "maxPatchOperations": {
            "type": "integer",
            "minimum": 1
          },
          "allowedNodeTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowedMarkTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "stableIdNodeTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "patchOperations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "image": {
            "type": "object",
            "required": [
              "maxBytes",
              "contentTypes",
              "allowedHostPatterns"
            ],
            "properties": {
              "maxBytes": {
                "type": "integer",
                "minimum": 1
              },
              "contentTypes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "allowedHostPatterns": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Hostname patterns that the job Instructions renderer permits for image src URLs. Upload other images through the canonical job image endpoint first."
              }
            }
          },
          "video": {
            "$ref": "#/components/schemas/JobInstructionVideoCapability"
          },
          "imports": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "mutations": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "immediatelyWorkerVisible",
              "workerVisibility",
              "workerReadCutoverMode",
              "releasesEnabledForActor",
              "preflightRequired",
              "canonicalReadBackRequired",
              "atomicTreeApply"
            ],
            "properties": {
              "immediatelyWorkerVisible": {
                "type": "boolean",
                "description": "TRUE only while the worker-read cutover is OFF (workers read live drafts). Once the cutover is on, workers read the active release and a confirmed draft write stays invisible until a separate publish."
              },
              "workerVisibility": {
                "type": "string",
                "enum": [
                  "IMMEDIATE",
                  "ON_PUBLISH",
                  "MIXED"
                ],
                "description": "IMMEDIATE: every worker reads live drafts. ON_PUBLISH: every worker reads the active release — publish to deliver. MIXED: the cutover is partially rolled out, so visibility depends on the reading worker; treat a draft write as NOT delivered until published."
              },
              "workerReadCutoverMode": {
                "type": "string",
                "enum": [
                  "OFF",
                  "ADMIN_ONLY",
                  "ALLOWLIST",
                  "ALL"
                ],
                "description": "Global rollout mode of the worker-read cutover at the time of the read."
              },
              "releasesEnabledForActor": {
                "type": "boolean",
                "description": "Immutable releases (prepare / preview / publish) are available to this actor."
              },
              "preflightRequired": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "canonicalReadBackRequired": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "atomicTreeApply": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            }
          },
          "localBundles": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "pageLinks": {
            "type": "object",
            "required": [
              "supported",
              "actorAware",
              "stableNodeAnchors",
              "pathTemplate"
            ],
            "properties": {
              "supported": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "actorAware": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "stableNodeAnchors": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "pathTemplate": {
                "type": "string",
                "enum": [
                  "/instructions/{jobId}/{pageId}"
                ]
              }
            }
          },
          "contentSchemas": {
            "type": "object",
            "additionalProperties": true,
            "description": "Page content-schema versioning: supportedVersions, defaultVersion, allowedNodeTypesByVersion, stableIdNodeTypesByVersion, YouTube embed limits, and the two-step schema-upgrade workflow (request → wait until quiesceReadyAt → complete)."
          },
          "authoringRules": {
            "type": "object",
            "additionalProperties": true,
            "description": "Write-time node rules that preview, preflight and every write enforce identically. stableNodeIds: every node of a stable-id type (nodeTypesByVersion) needs a client-supplied attrs.id, any non-empty string unique within the page (UUID recommended); the server never assigns ids. callout (content schema 2+): attrs.variant is required, one of INFO, WARNING, IMPORTANT, STOP_RULE, with no title or tone; example is a valid callout node."
          }
        }
      },
      "JobInstructionPageResponse": {
        "type": "object",
        "required": [
          "location",
          "page",
          "content"
        ],
        "properties": {
          "location": {
            "$ref": "#/components/schemas/JobInstructionLocation"
          },
          "page": {
            "$ref": "#/components/schemas/JobInstructionPageSummary"
          },
          "content": {
            "$ref": "#/components/schemas/JobInstructionDocument"
          }
        }
      },
      "JobInstructionReleasedPageResponse": {
        "type": "object",
        "description": "OPE-41073: one page exactly as workers read it (GET …/pages/{pageId}?released=true): the job’s released effective view, folder release first, then job release; GOOGLE_DOC content is live, as workers read it. content.checksum equals the checksum a released quiz grounding snapshot pins for the page. Write grounded quiz questions from this text, never the draft.",
        "required": [
          "location",
          "source",
          "page",
          "content"
        ],
        "properties": {
          "location": {
            "$ref": "#/components/schemas/JobInstructionLocation"
          },
          "source": {
            "type": "string",
            "enum": [
              "released"
            ]
          },
          "page": {
            "$ref": "#/components/schemas/JobInstructionReleasedPageSummary"
          },
          "content": {
            "$ref": "#/components/schemas/JobInstructionDocument"
          }
        },
        "additionalProperties": false
      },
      "JobInstructionReleasedPageSummary": {
        "type": "object",
        "description": "Release-pinned identity of a released page (never editable; no draft metadata).",
        "required": [
          "id",
          "instructionSetId",
          "parentPageId",
          "title",
          "icon",
          "sortOrder",
          "contentSchemaVersion",
          "kind",
          "inherited",
          "releaseId",
          "publishedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "instructionSetId": {
            "type": "string"
          },
          "parentPageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          },
          "sortOrder": {
            "type": "integer"
          },
          "contentSchemaVersion": {
            "type": "integer",
            "minimum": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "TIPTAP",
              "GOOGLE_DOC"
            ]
          },
          "inherited": {
            "type": "boolean",
            "description": "True when the page comes from the job folder’s release."
          },
          "releaseId": {
            "type": "string"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "JobInstructionPageLinkResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "pageId",
          "title",
          "shareUrl",
          "anchorId",
          "anchorUrl"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "pageId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "shareUrl": {
            "type": "string",
            "format": "uri"
          },
          "anchorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "anchorUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "InstructionNodePatchOp": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "op",
              "nodeId",
              "node"
            ],
            "properties": {
              "op": {
                "type": "string",
                "enum": [
                  "replace_node"
                ]
              },
              "nodeId": {
                "type": "string",
                "minLength": 1
              },
              "node": {
                "$ref": "#/components/schemas/InstructionDocNode"
              },
              "expectedChecksum": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "op",
              "nodeId",
              "nodes"
            ],
            "properties": {
              "op": {
                "type": "string",
                "enum": [
                  "insert_before",
                  "insert_after"
                ]
              },
              "nodeId": {
                "type": "string",
                "minLength": 1
              },
              "nodes": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/InstructionDocNode"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "op",
              "nodeId",
              "nodes"
            ],
            "properties": {
              "op": {
                "type": "string",
                "enum": [
                  "append_children"
                ]
              },
              "nodeId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "nodes": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/InstructionDocNode"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "op",
              "nodeId",
              "attrs"
            ],
            "properties": {
              "op": {
                "type": "string",
                "enum": [
                  "set_attrs"
                ]
              },
              "nodeId": {
                "type": "string",
                "minLength": 1
              },
              "attrs": {
                "type": "object",
                "additionalProperties": true
              }
            }
          },
          {
            "type": "object",
            "required": [
              "op",
              "nodeId"
            ],
            "properties": {
              "op": {
                "type": "string",
                "enum": [
                  "delete_node"
                ]
              },
              "nodeId": {
                "type": "string",
                "minLength": 1
              },
              "expectedChecksum": {
                "type": "string"
              }
            }
          }
        ]
      },
      "JobInstructionPageCreateRequest": {
        "type": "object",
        "required": [
          "title",
          "preflightToken",
          "confirmLive"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "parentPageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "beforePageId": {
            "type": "string"
          },
          "afterPageId": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "minimum": 0
          },
          "content": {
            "$ref": "#/components/schemas/JobInstructionDoc"
          },
          "contentSchemaVersion": {
            "type": "integer",
            "enum": [
              1,
              2
            ],
            "default": 1,
            "description": "Content-schema version for the new page (default 1). Version 2 admits the rich block set (details/callout/youtube/audio/attachment)."
          },
          "preflightToken": {
            "type": "string",
            "description": "Signed token returned by the exact no-write preflight."
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "JobInstructionPageReplaceRequest": {
        "type": "object",
        "required": [
          "content",
          "expectedChecksum",
          "preflightToken",
          "confirmReplace",
          "confirmLive"
        ],
        "properties": {
          "content": {
            "$ref": "#/components/schemas/JobInstructionDoc"
          },
          "expectedChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "preflightToken": {
            "type": "string"
          },
          "confirmReplace": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "JobInstructionPagePatchRequest": {
        "type": "object",
        "required": [
          "expectedChecksum",
          "operations",
          "preflightToken",
          "confirmLive"
        ],
        "properties": {
          "expectedChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "operations": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/InstructionNodePatchOp"
            }
          },
          "preflightToken": {
            "type": "string"
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "JobInstructionPageMetadataRequest": {
        "type": "object",
        "required": [
          "preflightToken",
          "confirmLive"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "parentPageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "up",
              "down"
            ]
          },
          "icon": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32,
            "description": "Set the page-identity icon ('emoji:<glyph>' or 'lucide:<curated-name>') or null to clear it. Unsupported values fail with UNSUPPORTED_PAGE_ICON."
          },
          "preflightToken": {
            "type": "string"
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "JobInstructionPageArchiveRequest": {
        "type": "object",
        "required": [
          "preflightToken",
          "confirmArchive",
          "confirmLive"
        ],
        "properties": {
          "preflightToken": {
            "type": "string"
          },
          "confirmArchive": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "JobInstructionCheckpointSummary": {
        "type": "object",
        "required": [
          "checkpointId",
          "createdAt",
          "origin",
          "actorUserId",
          "actorType",
          "contentDigest",
          "sizeBytes"
        ],
        "properties": {
          "checkpointId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "origin": {
            "type": "string",
            "description": "Closed provenance vocabulary (see capabilities.history.origins): SWEEP, PAGE_CREATE, PAGE_REPLACE, TREE_APPLY, DOCX_IMPORT, SCHEMA_UPGRADE, MANUAL, RESTORE_BASELINE, RESTORE."
          },
          "actorUserId": {
            "type": "string",
            "nullable": true
          },
          "actorType": {
            "type": "string",
            "enum": [
              "EMPLOYER",
              "AGENT",
              "SYSTEM"
            ]
          },
          "contentDigest": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer"
          },
          "sourceDocumentName": {
            "type": "string",
            "description": "Diagnostic room reference; agent surfaces only."
          }
        }
      },
      "JobInstructionRevisionResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "location",
          "revisionToken",
          "job",
          "folder",
          "effectiveScope"
        ],
        "properties": {
          "location": {
            "$ref": "#/components/schemas/JobInstructionLocation"
          },
          "revisionToken": {
            "type": "string",
            "description": "Opaque, comparable token of the effective revision pair, bound to the job (sibling jobs with equal counters never share one); also the strong response ETag — the body is a pure function of it. Send it as If-None-Match to receive 304 while nothing changed."
          },
          "job": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "scopeId",
              "revision"
            ],
            "properties": {
              "scopeId": {
                "type": "string"
              },
              "revision": {
                "type": "integer",
                "minimum": 0
              }
            },
            "description": "The job’s own set: bumped on every committed change to it (and on folder membership changes)."
          },
          "folder": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "required": [
              "scopeId",
              "revision"
            ],
            "properties": {
              "scopeId": {
                "type": "string"
              },
              "revision": {
                "type": "integer",
                "minimum": 0
              }
            },
            "description": "The folder set the job inherits, when it is in a folder."
          },
          "effectiveScope": {
            "type": "string",
            "enum": [
              "JOB",
              "FOLDER"
            ],
            "description": "Which set workers read through this job (location.managedAt)."
          }
        }
      },
      "JobInstructionComplianceRow": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contractId",
          "workerUserId",
          "workerDisplayName",
          "status",
          "outstandingCount",
          "oldestOutstandingAt",
          "lastReadAt",
          "lastUnderstoodAt"
        ],
        "properties": {
          "contractId": {
            "type": "string"
          },
          "workerUserId": {
            "type": "string"
          },
          "workerDisplayName": {
            "type": "string",
            "description": "Masked like every agent roster (\"First L.\"); never a full last name."
          },
          "status": {
            "type": "string",
            "enum": [
              "NO_REVIEW_REQUIRED",
              "SYNCING",
              "ACTION_REQUIRED",
              "MARKED_READ",
              "UNDERSTOOD"
            ],
            "description": "NO_REVIEW_REQUIRED: nothing outstanding, nothing ever required. SYNCING: a READ_REQUIRED release is published but its obligation has not fanned out to this contract yet. ACTION_REQUIRED: an outstanding obligation is unread. MARKED_READ: every outstanding obligation is read but not understood. UNDERSTOOD: nothing outstanding; the last obligation was understood."
          },
          "outstandingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Obligations not yet understood (1 while a release is still SYNCING)."
          },
          "oldestOutstandingAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastReadAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastUnderstoodAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "JobInstructionComplianceResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "location",
          "rows",
          "hasMore",
          "nextCursor"
        ],
        "properties": {
          "location": {
            "$ref": "#/components/schemas/JobInstructionLocation"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionComplianceRow"
            },
            "description": "Participating contracts of the job, ordered by contract id."
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque keyset cursor for the next page; null at the end."
          }
        }
      },
      "JobInstructionReminderRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "releaseId",
          "idempotencyKey"
        ],
        "properties": {
          "releaseId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "A READ_REQUIRED release of the job’s Instructions or of the folder the job inherits (releaseId from job_instructions.releases.list)."
          },
          "workerUserIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "description": "Remind only these workers. Omitted: every worker with a requirement for this release, 100 per call (follow nextCursor)."
          },
          "cursor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "nextCursor from a previous call for the SAME job and release, only without workerUserIds. Another job’s or release’s cursor fails with HTTP 400 code INVALID_CURSOR."
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]{1,128}$",
            "description": "Must equal the Idempotency-Key header. A replay returns the stored result; the same key with another payload is 409 IDEMPOTENCY_KEY_REUSED."
          }
        }
      },
      "JobInstructionReminderResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workerUserId",
          "workerDisplayName",
          "outcome",
          "remindedAt"
        ],
        "properties": {
          "workerUserId": {
            "type": "string"
          },
          "workerDisplayName": {
            "type": "string",
            "description": "Masked like every agent roster (\"First L.\"); never a full last name."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "REMINDED",
              "ALREADY_REMINDED",
              "ALREADY_ACKNOWLEDGED",
              "NOT_REQUIRED",
              "NOT_ON_JOB",
              "ACCOUNT_INACTIVE",
              "NOTIFICATIONS_OFF",
              "FAILED"
            ],
            "description": "REMINDED: this call sent the reminder. ALREADY_REMINDED: a reminder for this release was sent before (by any caller); nothing sent. ALREADY_ACKNOWLEDGED: the worker confirmed they understood this release. NOT_REQUIRED: no outstanding requirement for this release (hired after it, covered by the starting baseline, or Read Required is not available to the worker). NOT_ON_JOB: no active contract on this job (left, ended or never hired). ACCOUNT_INACTIVE: the worker’s account is banned, closed or has a deletion pending. NOTIFICATIONS_OFF: the worker turned off in-app Read Required reminders, so nothing was sent and no reminder was recorded. FAILED: the notification could not be written and no reminder was recorded; retry with a NEW idempotency key."
          },
          "remindedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When this release’s reminder was sent (REMINDED / ALREADY_REMINDED)."
          }
        }
      },
      "JobInstructionReminderResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jobId",
          "releaseId",
          "results",
          "summary",
          "hasMore",
          "nextCursor",
          "replayed"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "releaseId": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionReminderResult"
            },
            "description": "One row per worker handled by this call."
          },
          "summary": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "REMINDED",
              "ALREADY_REMINDED",
              "ALREADY_ACKNOWLEDGED",
              "NOT_REQUIRED",
              "NOT_ON_JOB",
              "ACCOUNT_INACTIVE",
              "NOTIFICATIONS_OFF",
              "FAILED"
            ],
            "properties": {
              "REMINDED": {
                "type": "integer",
                "minimum": 0
              },
              "ALREADY_REMINDED": {
                "type": "integer",
                "minimum": 0
              },
              "ALREADY_ACKNOWLEDGED": {
                "type": "integer",
                "minimum": 0
              },
              "NOT_REQUIRED": {
                "type": "integer",
                "minimum": 0
              },
              "NOT_ON_JOB": {
                "type": "integer",
                "minimum": 0
              },
              "ACCOUNT_INACTIVE": {
                "type": "integer",
                "minimum": 0
              },
              "NOTIFICATIONS_OFF": {
                "type": "integer",
                "minimum": 0
              },
              "FAILED": {
                "type": "integer",
                "minimum": 0
              }
            },
            "description": "Count per outcome over results."
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque job + release bound cursor for the next page; null at the end."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this is the stored result of an earlier call with the same idempotency key (nothing was sent again)."
          }
        }
      },
      "JobInstructionSearchMatchRange": {
        "type": "object",
        "required": [
          "start",
          "end"
        ],
        "description": "Code-point range into the snippet text to highlight (end exclusive).",
        "properties": {
          "start": {
            "type": "integer",
            "minimum": 0
          },
          "end": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobInstructionSearchSnippet": {
        "type": "object",
        "required": [
          "text",
          "matchRanges",
          "leadingEllipsis",
          "trailingEllipsis"
        ],
        "description": "Inert plain-text excerpt of the matched block (never HTML).",
        "properties": {
          "text": {
            "type": "string"
          },
          "matchRanges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionSearchMatchRange"
            }
          },
          "leadingEllipsis": {
            "type": "boolean"
          },
          "trailingEllipsis": {
            "type": "boolean"
          }
        }
      },
      "JobInstructionSearchHit": {
        "type": "object",
        "required": [
          "blockId",
          "anchorId",
          "headingAncestorText",
          "blockOrdinal",
          "isPageTitleHit",
          "snippets",
          "rank"
        ],
        "properties": {
          "blockId": {
            "type": "string",
            "description": "Stable block id inside the page document (the patch target)."
          },
          "anchorId": {
            "type": "string",
            "nullable": true,
            "description": "Anchor id for a deep link into the page, when the block carries one."
          },
          "headingAncestorText": {
            "type": "string",
            "nullable": true
          },
          "blockOrdinal": {
            "type": "integer",
            "minimum": 0
          },
          "isPageTitleHit": {
            "type": "boolean",
            "description": "True for the synthetic page-title row (title-only match; no snippets)."
          },
          "snippets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionSearchSnippet"
            }
          },
          "rank": {
            "type": "number"
          }
        }
      },
      "JobInstructionSearchPage": {
        "type": "object",
        "required": [
          "pageId",
          "title",
          "breadcrumb",
          "scopeType",
          "shareUrl",
          "totalHits",
          "hits"
        ],
        "properties": {
          "pageId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "breadcrumb": {
            "type": "string",
            "description": "\"Parent › Child\" path inside its set."
          },
          "scopeType": {
            "type": "string",
            "enum": [
              "JOB",
              "FOLDER"
            ],
            "description": "Which effective scope the page belongs to."
          },
          "shareUrl": {
            "type": "string",
            "nullable": true,
            "description": "Canonical actor-aware page URL (the same one inspect reports)."
          },
          "totalHits": {
            "type": "integer",
            "minimum": 1,
            "description": "Hits in this page inside the ranked window; hits[] carries at most 5."
          },
          "hits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionSearchHit"
            }
          }
        }
      },
      "JobInstructionSearchResponse": {
        "type": "object",
        "required": [
          "location",
          "query",
          "variant",
          "scopes",
          "pages",
          "totalBlockHits",
          "totalPages",
          "truncated",
          "windowRows",
          "usedTrigramFallback",
          "hasMore",
          "nextCursor"
        ],
        "properties": {
          "location": {
            "$ref": "#/components/schemas/JobInstructionLocation"
          },
          "query": {
            "type": "string",
            "description": "The normalized query that was searched."
          },
          "variant": {
            "type": "string",
            "enum": [
              "DRAFT"
            ],
            "description": "What this token reads through the public API: the draft corpus."
          },
          "scopes": {
            "type": "array",
            "description": "The effective scopes searched: the job set, plus the inherited folder set.",
            "items": {
              "type": "object",
              "required": [
                "scopeType",
                "scopeId"
              ],
              "properties": {
                "scopeType": {
                  "type": "string",
                  "enum": [
                    "JOB",
                    "FOLDER"
                  ]
                },
                "scopeId": {
                  "type": "string"
                }
              }
            }
          },
          "pages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionSearchPage"
            }
          },
          "totalBlockHits": {
            "type": "integer",
            "minimum": 0,
            "description": "Block hits inside the ranked window, across every page group."
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0,
            "description": "Page groups in the ranked window, across every response page."
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the ranked window (windowRows) filled: more blocks match than were ranked, so paging cannot reach them — narrow the query."
          },
          "windowRows": {
            "type": "integer"
          },
          "usedTrigramFallback": {
            "type": "boolean"
          },
          "hasMore": {
            "type": "boolean",
            "description": "More page groups follow in the ranked window."
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor bound to the job, the query and the ranked window. A cursor from another search fails with HTTP 400 code INVALID_CURSOR."
          }
        }
      },
      "JobInstructionHistoryResponse": {
        "type": "object",
        "required": [
          "pageId",
          "pageTitle",
          "archived",
          "checkpoints",
          "hasMore",
          "nextCursor"
        ],
        "properties": {
          "pageId": {
            "type": "string"
          },
          "pageTitle": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          },
          "checkpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionCheckpointSummary"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Versioned page-bound keyset cursor. Foreign or malformed cursors fail deterministically with HTTP 400 code INVALID_CURSOR."
          },
          "currentDocumentName": {
            "type": "string"
          }
        }
      },
      "JobInstructionCheckpointContentResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobInstructionCheckpointSummary"
          },
          {
            "type": "object",
            "required": [
              "pageId",
              "docJson",
              "plainText"
            ],
            "properties": {
              "pageId": {
                "type": "string"
              },
              "docJson": {
                "type": "object"
              },
              "plainText": {
                "type": "string"
              }
            }
          }
        ]
      },
      "JobInstructionCheckpointCompareSide": {
        "type": "object",
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "checkpoint",
              "current"
            ]
          },
          "checkpointId": {
            "type": "string"
          },
          "contentDigest": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "origin": {
            "type": "string"
          },
          "checksum": {
            "type": "string",
            "description": "Present when kind=current: the live-document checksum, usable as expectedChecksum for a conflict-aware follow-up write."
          },
          "documentName": {
            "type": "string",
            "description": "Diagnostic room reference; agent surfaces only."
          }
        }
      },
      "JobInstructionHistoryTextDelta": {
        "type": "object",
        "required": [
          "beforePrefix",
          "beforeChanged",
          "beforeSuffix",
          "afterPrefix",
          "afterChanged",
          "afterSuffix"
        ],
        "properties": {
          "beforePrefix": {
            "type": "string"
          },
          "beforeChanged": {
            "type": "string"
          },
          "beforeSuffix": {
            "type": "string"
          },
          "afterPrefix": {
            "type": "string"
          },
          "afterChanged": {
            "type": "string"
          },
          "afterSuffix": {
            "type": "string"
          }
        }
      },
      "JobInstructionHistoryBlockChange": {
        "type": "object",
        "required": [
          "kind",
          "blockId",
          "anchorId",
          "heading",
          "beforeText",
          "afterText"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "ADDED",
              "REMOVED",
              "MOVED",
              "MODIFIED",
              "MEDIA_CHANGED",
              "TABLE_CHANGED"
            ]
          },
          "blockId": {
            "type": "string",
            "description": "Stable TipTap node ID when present."
          },
          "anchorId": {
            "type": "string",
            "nullable": true
          },
          "heading": {
            "type": "string",
            "nullable": true
          },
          "beforeText": {
            "type": "string",
            "nullable": true
          },
          "afterText": {
            "type": "string",
            "nullable": true
          },
          "textDelta": {
            "$ref": "#/components/schemas/JobInstructionHistoryTextDelta"
          }
        }
      },
      "JobInstructionHistoryPageChange": {
        "type": "object",
        "required": [
          "pageId",
          "title",
          "previousTitle",
          "kinds",
          "blocks"
        ],
        "properties": {
          "pageId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "previousTitle": {
            "type": "string",
            "nullable": true
          },
          "kinds": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ADDED",
                "REMOVED",
                "RENAMED",
                "MOVED",
                "UPDATED"
              ]
            }
          },
          "blocks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionHistoryBlockChange"
            }
          }
        }
      },
      "JobInstructionHistoryDiff": {
        "type": "object",
        "required": [
          "fullReview",
          "pages",
          "counts"
        ],
        "properties": {
          "fullReview": {
            "type": "boolean"
          },
          "pages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobInstructionHistoryPageChange"
            }
          },
          "counts": {
            "type": "object",
            "required": [
              "pagesAdded",
              "pagesRemoved",
              "pagesChanged",
              "blocksAdded",
              "blocksRemoved",
              "blocksChanged"
            ],
            "properties": {
              "pagesAdded": {
                "type": "integer"
              },
              "pagesRemoved": {
                "type": "integer"
              },
              "pagesChanged": {
                "type": "integer"
              },
              "blocksAdded": {
                "type": "integer"
              },
              "blocksRemoved": {
                "type": "integer"
              },
              "blocksChanged": {
                "type": "integer"
              }
            }
          }
        }
      },
      "JobInstructionCheckpointCompareResponse": {
        "type": "object",
        "required": [
          "pageId",
          "from",
          "to",
          "diff"
        ],
        "properties": {
          "pageId": {
            "type": "string"
          },
          "from": {
            "$ref": "#/components/schemas/JobInstructionCheckpointCompareSide"
          },
          "to": {
            "$ref": "#/components/schemas/JobInstructionCheckpointCompareSide"
          },
          "diff": {
            "$ref": "#/components/schemas/JobInstructionHistoryDiff"
          }
        }
      },
      "JobInstructionManualCheckpointRequest": {
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]{1,128}$",
            "description": "When provided it must equal the Idempotency-Key header (receipt-tracked)."
          }
        }
      },
      "JobInstructionManualCheckpointResponse": {
        "type": "object",
        "required": [
          "pageId",
          "checkpointId",
          "contentDigest",
          "created",
          "liveChecksum",
          "replayed"
        ],
        "properties": {
          "pageId": {
            "type": "string"
          },
          "checkpointId": {
            "type": "string"
          },
          "contentDigest": {
            "type": "string"
          },
          "created": {
            "type": "boolean",
            "description": "false when live content already matched the latest checkpoint."
          },
          "liveChecksum": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobInstructionRestoreRequest": {
        "type": "object",
        "required": [
          "expectedChecksum",
          "confirmRestore",
          "confirmLive",
          "idempotencyKey"
        ],
        "properties": {
          "expectedChecksum": {
            "type": "string"
          },
          "confirmRestore": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]{1,128}$",
            "description": "Must equal the Idempotency-Key header; restores are always receipt-tracked."
          }
        }
      },
      "JobInstructionWriteVisibility": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workerVisibility",
          "workerReadCutoverMode",
          "draftRevision",
          "activeReleaseId",
          "deliveredToWorkers"
        ],
        "description": "What a confirmed job-scope write means for workers, stated on the write’s own response. Present on every job-scope authoring write (page create/replace/patch/metadata/archive, tree apply, restore — replays included); NOT on the schema-upgrade verbs (complete rewrites page content to the v2 node set, content-preserving — poll GET …/revision after it) and not on folder-scope writes. Read at response time, after the write’s transaction has committed; omitted (the write still succeeded) if that read fails.",
        "properties": {
          "workerVisibility": {
            "type": "string",
            "enum": [
              "IMMEDIATE",
              "ON_PUBLISH",
              "MIXED"
            ]
          },
          "workerReadCutoverMode": {
            "type": "string",
            "enum": [
              "OFF",
              "ADMIN_ONLY",
              "ALLOWLIST",
              "ALL"
            ]
          },
          "draftRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The job set’s revision counter at the response-time read, after the write’s transaction committed (the counter GET …/revision reports)."
          },
          "activeReleaseId": {
            "type": "string",
            "nullable": true,
            "description": "The release workers on the cutover read; null when nothing is published."
          },
          "deliveredToWorkers": {
            "type": "boolean",
            "description": "True only when workers read live drafts (IMMEDIATE)."
          }
        }
      },
      "JobInstructionRestoreResponse": {
        "type": "object",
        "required": [
          "ok",
          "restoredCheckpointId",
          "restoredContentDigest",
          "undoBaselineCheckpointId",
          "undoBaselineContentDigest",
          "replayed"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "restoredCheckpointId": {
            "type": "string"
          },
          "restoredContentDigest": {
            "type": "string"
          },
          "undoBaselineCheckpointId": {
            "type": "string",
            "description": "The pre-restore live content, durably pinned as the undo target."
          },
          "undoBaselineContentDigest": {
            "type": "string"
          },
          "content": {
            "type": "object",
            "description": "Restored canonical document with checksum."
          },
          "replayed": {
            "type": "boolean"
          },
          "visibility": {
            "$ref": "#/components/schemas/JobInstructionWriteVisibility"
          }
        }
      },
      "JobInstructionPageSchemaUpgradeRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "request",
              "status",
              "complete"
            ],
            "description": "Two-step quiesce workflow: \"request\" opens a PENDING upgrade and freezes new write-token issuance; wait until the returned quiesceReadyAt passes, then \"complete\" performs the cutover. \"status\" reports the current state without changing anything. Every action is convergent and idempotent; no Idempotency-Key is used."
          }
        }
      },
      "JobInstructionPageSchemaUpgradeResponse": {
        "type": "object",
        "required": [
          "pageId",
          "contentSchemaVersion",
          "targetContentSchemaVersion",
          "upgrade"
        ],
        "properties": {
          "pageId": {
            "type": "string"
          },
          "contentSchemaVersion": {
            "type": "integer",
            "description": "Canonical page version re-read AFTER the action (the readback proof)."
          },
          "targetContentSchemaVersion": {
            "type": "integer",
            "description": "The version this upgrade workflow targets (currently always 2)."
          },
          "upgrade": {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "COMPLETED",
                  "PENDING",
                  "FAILED",
                  "NOT_REQUESTED"
                ]
              },
              "alreadyUpgraded": {
                "type": "boolean",
                "description": "True when the page was already at the target schema version."
              },
              "quiesceReadyAt": {
                "type": "string",
                "format": "date-time",
                "description": "Earliest instant a \"complete\" action can succeed."
              },
              "retryUntil": {
                "type": "string",
                "format": "date-time",
                "description": "The PENDING upgrade expires after this instant; re-request past it."
              },
              "failureCode": {
                "type": "string"
              }
            }
          }
        }
      },
      "JobInstructionPreviewRequest": {
        "type": "object",
        "required": [
          "content"
        ],
        "properties": {
          "content": {
            "$ref": "#/components/schemas/JobInstructionDoc"
          },
          "pageId": {
            "type": "string",
            "description": "Optional existing-page context. When set, the page must be an effective page of the requested job and validation runs against that page’s persisted content schema version (e.g. version 2 admits details/callout). Without it, validation uses contentSchemaVersion, else fails closed to the version-1 node set."
          },
          "contentSchemaVersion": {
            "type": "integer",
            "description": "New pages only: the version create will use (contentSchemaVersion on create), default 1. With pageId it must equal that page’s persisted version (400 CONTENT_SCHEMA_VERSION_MISMATCH otherwise)."
          }
        }
      },
      "JobInstructionPreflightRequest": {
        "type": "object",
        "required": [
          "operation"
        ],
        "properties": {
          "operation": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "type",
                  "title",
                  "idempotencyKey"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "create"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "parentPageId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "beforePageId": {
                    "type": "string"
                  },
                  "afterPageId": {
                    "type": "string"
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "content": {
                    "$ref": "#/components/schemas/JobInstructionDoc"
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "pageId",
                  "content",
                  "expectedChecksum",
                  "confirmReplace"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "replace"
                    ]
                  },
                  "pageId": {
                    "type": "string"
                  },
                  "content": {
                    "$ref": "#/components/schemas/JobInstructionDoc"
                  },
                  "expectedChecksum": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  },
                  "confirmReplace": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "pageId",
                  "expectedChecksum",
                  "operations"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "patch"
                    ]
                  },
                  "pageId": {
                    "type": "string"
                  },
                  "expectedChecksum": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  },
                  "operations": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "items": {
                      "$ref": "#/components/schemas/InstructionNodePatchOp"
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "pageId"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "metadata"
                    ]
                  },
                  "pageId": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "parentPageId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "up",
                      "down"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "pageId",
                  "confirmArchive"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "archive"
                    ]
                  },
                  "pageId": {
                    "type": "string"
                  },
                  "confirmArchive": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              }
            ]
          }
        }
      },
      "JobInstructionImagePlanRequest": {
        "type": "object",
        "required": [
          "fileName",
          "contentType",
          "sizeBytes",
          "sha256",
          "idempotencyKey"
        ],
        "properties": {
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "image/gif",
              "image/avif"
            ]
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4194304
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "JobInstructionVideoPrepareRequest": {
        "type": "object",
        "required": [
          "pageId",
          "fileName",
          "contentType",
          "sizeBytes",
          "durationSeconds",
          "idempotencyKey"
        ],
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "contentType": {
            "type": "string",
            "enum": [
              "video/mp4",
              "video/webm",
              "video/ogg",
              "video/quicktime"
            ]
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000000000
          },
          "durationSeconds": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 7200,
            "description": "REQUIRED measured media duration in seconds; sizes the provider storage reservation."
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "JobInstructionVideoCapability": {
        "type": "object",
        "required": [
          "provider",
          "rolloutEnabledForActor",
          "pipelineConfigured",
          "enabled",
          "maxBytes",
          "maxDurationSeconds",
          "contentTypes",
          "upload",
          "node",
          "verification"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "cloudflare-stream"
            ]
          },
          "rolloutEnabledForActor": {
            "type": "boolean"
          },
          "pipelineConfigured": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "maxBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000000000
          },
          "maxDurationSeconds": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 7200
          },
          "contentTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "video/mp4",
                "video/webm",
                "video/ogg",
                "video/quicktime"
              ]
            }
          },
          "upload": {
            "type": "object",
            "required": [
              "protocol",
              "direct",
              "client",
              "chunkBytes",
              "durationSecondsRequired",
              "uploadUrlSingleUse"
            ],
            "properties": {
              "protocol": {
                "type": "string",
                "enum": [
                  "tus"
                ]
              },
              "direct": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "client": {
                "type": "string",
                "enum": [
                  "tus-js-client@4.3.1"
                ]
              },
              "chunkBytes": {
                "type": "integer",
                "minimum": 1
              },
              "durationSecondsRequired": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "uploadUrlSingleUse": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            }
          },
          "node": {
            "type": "object",
            "required": [
              "type",
              "altMarker",
              "srcPattern",
              "schemaCompatibility"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image"
                ]
              },
              "altMarker": {
                "type": "string",
                "enum": [
                  "opentrain-instruction-video:upload"
                ]
              },
              "srcPattern": {
                "type": "string",
                "enum": [
                  "/api/instructions/videos/{assetId}"
                ]
              },
              "schemaCompatibility": {
                "type": "string",
                "enum": [
                  "v1"
                ]
              }
            }
          },
          "verification": {
            "type": "object",
            "required": [
              "restReadback",
              "browserRenderVerified",
              "guidance"
            ],
            "properties": {
              "restReadback": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "browserRenderVerified": {
                "type": "boolean",
                "enum": [
                  false
                ]
              },
              "guidance": {
                "type": "string"
              }
            }
          }
        }
      },
      "JobInstructionVideoNode": {
        "type": "object",
        "required": [
          "type",
          "src",
          "alt"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image"
            ]
          },
          "src": {
            "type": "string",
            "pattern": "^/api/instructions/videos/[0-9a-fA-F-]+$"
          },
          "alt": {
            "type": "string",
            "enum": [
              "opentrain-instruction-video:upload"
            ]
          }
        }
      },
      "JobInstructionVideoPrepareResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "pageId",
          "assetId",
          "status",
          "protocol",
          "chunkBytes",
          "contentType",
          "sizeBytes",
          "fileName",
          "uploadMaxDurationSeconds",
          "uploadExpiresAt",
          "node",
          "replayed",
          "uploadUrl"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "pageId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING"
            ]
          },
          "protocol": {
            "type": "string",
            "enum": [
              "tus"
            ]
          },
          "chunkBytes": {
            "type": "integer",
            "minimum": 1
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000000000
          },
          "fileName": {
            "type": "string"
          },
          "uploadMaxDurationSeconds": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "uploadExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "node": {
            "$ref": "#/components/schemas/JobInstructionVideoNode"
          },
          "replayed": {
            "type": "boolean"
          },
          "uploadUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Bearer-like one-time TUS URL. Returned only on the first 201 response; never persisted or replayed."
          },
          "recovery": {
            "type": "object",
            "required": [
              "reason",
              "message",
              "statusPath",
              "cancelPath"
            ],
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "UPLOAD_URL_NOT_REPLAYABLE"
                ]
              },
              "message": {
                "type": "string"
              },
              "statusPath": {
                "type": "string"
              },
              "cancelPath": {
                "type": "string"
              }
            }
          }
        }
      },
      "JobInstructionVideoStatusResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "pageId",
          "assetId",
          "provider",
          "status",
          "storageReady",
          "playbackReady",
          "browserVerified",
          "url",
          "durationSeconds",
          "widthPx",
          "heightPx",
          "errorCode",
          "uploadExpiresAt"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "pageId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "SUPABASE",
              "CLOUDFLARE_STREAM"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "READY",
              "ERRORED"
            ]
          },
          "storageReady": {
            "type": "boolean"
          },
          "playbackReady": {
            "type": "boolean"
          },
          "browserVerified": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "url": {
            "type": "string"
          },
          "durationSeconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "widthPx": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "heightPx": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "uploadExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "JobInstructionVideoCancelResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "assetId",
          "status"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "canceled",
              "canceling",
              "ready"
            ]
          }
        }
      },
      "JobInstructionPrivateAssetNode": {
        "description": "The exact schema-v2 node to insert once the asset is READY: instructionAudio {assetId, title} or instructionAttachment {assetId, fileName, contentType, sizeBytes}.",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "attrs"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "instructionAudio"
                ]
              },
              "attrs": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "assetId",
                  "title"
                ],
                "properties": {
                  "assetId": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "attrs"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "instructionAttachment"
                ]
              },
              "attrs": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "assetId",
                  "fileName",
                  "contentType",
                  "sizeBytes"
                ],
                "properties": {
                  "assetId": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  },
                  "contentType": {
                    "type": "string"
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        ]
      },
      "JobInstructionPrivateAssetPrepareRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "pageId",
          "fileName",
          "contentType",
          "sizeBytes",
          "idempotencyKey"
        ],
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "contentType": {
            "type": "string",
            "description": "audio: audio/mpeg, audio/mp4, audio/ogg, audio/wav. file: application/pdf, the DOCX and XLSX OpenXML types, text/csv, text/plain. The path kind decides which set applies."
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "description": "Declared size; audio ≤ 52,428,800 bytes, file ≤ 26,214,400 bytes. The finalize step verifies the stored bytes."
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "JobInstructionPrivateAssetPrepareResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "pageId",
          "assetId",
          "kind",
          "status",
          "contentType",
          "sizeBytes",
          "fileName",
          "url",
          "upload",
          "uploadExpiresAt",
          "node",
          "replayed",
          "uploadUrl"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "pageId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "AUDIO",
              "FILE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING"
            ]
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer"
          },
          "fileName": {
            "type": "string",
            "description": "The validated, display-safe filename the server persisted — use THIS in the node."
          },
          "url": {
            "type": "string",
            "description": "Stable authenticated delivery URL (/api/instructions/assets/{assetId}) the node resolves to once READY."
          },
          "upload": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "method",
              "contentType",
              "maxBytes",
              "finalizeRequired"
            ],
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "PUT"
                ]
              },
              "contentType": {
                "type": "string",
                "description": "Send exactly this Content-Type with the bytes."
              },
              "maxBytes": {
                "type": "integer"
              },
              "finalizeRequired": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            }
          },
          "uploadExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "node": {
            "$ref": "#/components/schemas/JobInstructionPrivateAssetNode"
          },
          "replayed": {
            "type": "boolean"
          },
          "uploadUrl": {
            "type": "string",
            "nullable": true,
            "description": "One-time signed PUT URL — present ONLY on the first (non-replayed) response; never persisted or replayed."
          },
          "recovery": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "reason",
              "message",
              "statusPath",
              "cancelPath"
            ],
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "UPLOAD_URL_NOT_REPLAYABLE"
                ]
              },
              "message": {
                "type": "string"
              },
              "statusPath": {
                "type": "string"
              },
              "cancelPath": {
                "type": "string"
              }
            }
          }
        }
      },
      "JobInstructionPrivateAssetStatusResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "pageId",
          "assetId",
          "kind",
          "status",
          "storageReady",
          "contentType",
          "sizeBytes",
          "fileName",
          "url",
          "errorCode",
          "uploadExpiresAt",
          "node"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "pageId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "AUDIO",
              "FILE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "READY",
              "ERRORED"
            ],
            "description": "PENDING = awaiting bytes/finalize; READY = verified and served; ERRORED = terminal (cancel tombstone or failed verification)."
          },
          "storageReady": {
            "type": "boolean"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "description": "Verified bytes once READY, the declared size before."
          },
          "fileName": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "errorCode": {
            "type": "string",
            "nullable": true
          },
          "uploadExpiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "node": {
            "$ref": "#/components/schemas/JobInstructionPrivateAssetNode"
          }
        }
      },
      "JobInstructionPrivateAssetFinalizeResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "assetId",
          "kind",
          "status",
          "url",
          "node"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "AUDIO",
              "FILE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "READY"
            ]
          },
          "url": {
            "type": "string"
          },
          "node": {
            "$ref": "#/components/schemas/JobInstructionPrivateAssetNode"
          }
        }
      },
      "JobInstructionPrivateAssetCancelResponse": {
        "type": "object",
        "required": [
          "canonicalSource",
          "jobId",
          "assetId",
          "status"
        ],
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTION_SET"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "canceled",
              "canceling",
              "ready"
            ]
          }
        }
      },
      "JobInstructionTreeDesiredPage": {
        "type": "object",
        "required": [
          "ref",
          "title",
          "parentRef",
          "position",
          "content"
        ],
        "properties": {
          "ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "pageId": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "icon": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32,
            "description": "Bounded page icon ('emoji:<glyph>' | 'lucide:<curated-name>'). Omit to leave the persisted icon untouched; null clears it. Unsupported values fail with UNSUPPORTED_PAGE_ICON."
          },
          "parentRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "position": {
            "type": "integer",
            "minimum": 0
          },
          "content": {
            "$ref": "#/components/schemas/JobInstructionDoc"
          },
          "expectedChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "contentSchemaVersion": {
            "type": "integer",
            "enum": [
              1,
              2
            ],
            "default": 1,
            "description": "NEW pages only (default 1). Existing pages keep their persisted content-schema version."
          }
        }
      },
      "JobInstructionTreePreflightRequest": {
        "type": "object",
        "required": [
          "expectedTreeChecksum",
          "pages",
          "confirmTreeReplace",
          "idempotencyKey"
        ],
        "properties": {
          "expectedTreeChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "pages": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/JobInstructionTreeDesiredPage"
            }
          },
          "archivedPageIds": {
            "type": "array",
            "maxItems": 500,
            "description": "Omit on the initial preflight. Supply the exact reviewed response value on recovery preflight and live apply.",
            "items": {
              "type": "string"
            }
          },
          "confirmTreeReplace": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "JobInstructionTreeApplyRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobInstructionTreePreflightRequest"
          },
          {
            "type": "object",
            "required": [
              "archivedPageIds",
              "preflightToken",
              "confirmLive"
            ],
            "properties": {
              "archivedPageIds": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "string"
                }
              },
              "preflightToken": {
                "type": "string"
              },
              "confirmLive": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            }
          }
        ]
      },
      "JobOpsEvidenceRef": {
        "type": "object",
        "description": "A privacy-safe pointer at one canonical record (or another ops-plane row). Evidence references carry identity, never content.",
        "required": [
          "domain",
          "entityType",
          "entityId"
        ],
        "additionalProperties": false,
        "properties": {
          "domain": {
            "type": "string",
            "enum": [
              "PROPOSAL",
              "CONTRACT",
              "IDENTITY",
              "TODO",
              "TRAINING",
              "MESSAGE",
              "PAYMENT",
              "PROVIDER",
              "OPS"
            ]
          },
          "entityType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "entityId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "field": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          }
        }
      },
      "JobOpsGateSignal": {
        "type": "object",
        "description": "Typed, privacy-safe workflow gate signal an observation may carry. Only observations with a matching key feed OBSERVATION-sourced workflow gates.",
        "required": [
          "key",
          "status",
          "satisfied"
        ],
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "status": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "satisfied": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "JobOpsWorkflowDefinition": {
        "type": "object",
        "description": "Versioned typed workflow contract. Malformed definitions fail closed at publish. IDENTITY/LOCATION gates are never waivable and may bind only the canonical job_participation_eligibility source; native_form/lms_course/work_assessment sources require an exact entityId binding.",
        "required": [
          "schemaVersion",
          "gates"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "gates": {
            "type": "array",
            "maxItems": 30,
            "items": {
              "type": "object",
              "required": [
                "gateKey",
                "label",
                "required",
                "blocking",
                "overrideAllowed",
                "source"
              ],
              "additionalProperties": false,
              "properties": {
                "gateKey": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60,
                  "pattern": "^[A-Z][A-Z0-9_]*$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "required": {
                  "type": "boolean"
                },
                "blocking": {
                  "type": "boolean"
                },
                "overrideAllowed": {
                  "type": "boolean"
                },
                "source": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "kind",
                        "domain",
                        "entityType"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "CANONICAL"
                          ]
                        },
                        "domain": {
                          "type": "string",
                          "enum": [
                            "PROPOSAL",
                            "CONTRACT",
                            "IDENTITY",
                            "TODO",
                            "TRAINING",
                            "MESSAGE",
                            "PAYMENT",
                            "PROVIDER",
                            "OPS"
                          ]
                        },
                        "entityType": {
                          "type": "string",
                          "enum": [
                            "native_form",
                            "lms_course",
                            "work_assessment",
                            "job_participation_eligibility"
                          ]
                        },
                        "entityId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind",
                        "observationKey"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "OBSERVATION"
                          ]
                        },
                        "observationKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "PERSON",
                            "PROJECT"
                          ],
                          "description": "PERSON (default): only person-scoped observations bind. PROJECT: a subject-null observation broadcasts to every person."
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "JobOpsGateProjection": {
        "type": "object",
        "description": "One derived gate: status, tri-state satisfaction, the authority that produced it (DERIVED evidence vs DECIDED override), and evidence pointers.",
        "required": [
          "status",
          "satisfied",
          "authority",
          "evidenceRefs"
        ],
        "properties": {
          "status": {
            "type": "string"
          },
          "satisfied": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "authority": {
            "type": "string",
            "enum": [
              "OBSERVED",
              "DERIVED",
              "DECIDED",
              "INFERRED",
              "RECOMMENDED"
            ]
          },
          "decisionId": {
            "type": "string"
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          }
        }
      },
      "JobOpsPersonSummary": {
        "type": "object",
        "description": "Compact roster entry (context view=compact): identity label, lifecycle, readiness, blockers, screening verdict status, and unresolved-payment flag.",
        "required": [
          "personUserId",
          "displayLabel",
          "lifecycleStage",
          "readiness",
          "blockers",
          "screening",
          "paymentsUnresolved"
        ],
        "properties": {
          "personUserId": {
            "type": "string"
          },
          "displayLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "lifecycleStage": {
            "type": "string",
            "enum": [
              "APPLICANT",
              "ACTIVE",
              "ENDED",
              "OBSERVED"
            ]
          },
          "readiness": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "PENDING",
              "READY",
              "BLOCKED"
            ]
          },
          "blockers": {
            "$ref": "#/components/schemas/JobOpsBlockerList"
          },
          "screening": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "PASSED",
                  "FAILED",
                  "PENDING",
                  "IN_PROGRESS"
                ]
              }
            }
          },
          "paymentsUnresolved": {
            "type": "boolean"
          }
        }
      },
      "JobOpsBlockerList": {
        "type": "array",
        "items": {
          "type": "object",
          "required": [
            "code",
            "evidenceRefs"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "gateKey": {
              "type": "string"
            },
            "evidenceRefs": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/JobOpsEvidenceRef"
              }
            }
          }
        }
      },
      "JobOpsPersonProjection": {
        "type": "object",
        "description": "Full per-person projection (context view=full and person detail): lifecycle, readiness, raw vs operative gates with evidence, screening verdict, training progress, payment state, and blockers.",
        "required": [
          "personUserId",
          "displayLabel",
          "lifecycleStage",
          "lifecycleEvidenceRefs",
          "readiness",
          "rawGates",
          "operativeGates",
          "screening",
          "trainingProgress",
          "payments",
          "blockers",
          "evidenceRefs"
        ],
        "properties": {
          "personUserId": {
            "type": "string"
          },
          "displayLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "lifecycleStage": {
            "type": "string",
            "enum": [
              "APPLICANT",
              "ACTIVE",
              "ENDED",
              "OBSERVED"
            ]
          },
          "lifecycleEvidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "readiness": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "PENDING",
              "READY",
              "BLOCKED"
            ]
          },
          "rawGates": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JobOpsGateProjection"
            }
          },
          "operativeGates": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JobOpsGateProjection"
            }
          },
          "screening": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "attemptId",
              "status",
              "evidenceRefs"
            ],
            "properties": {
              "attemptId": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "PASSED",
                  "FAILED",
                  "PENDING",
                  "IN_PROGRESS"
                ]
              },
              "evidenceRefs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JobOpsEvidenceRef"
                }
              }
            }
          },
          "trainingProgress": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "assignmentId",
                "courseId",
                "courseVersionId",
                "assignmentStatus",
                "summaryComplete",
                "lessonsTotal",
                "lessonsCompleted",
                "requiredTotal",
                "requiredCompleted",
                "awaitingReview",
                "requiredAssessments",
                "evidenceRefs"
              ],
              "properties": {
                "assignmentId": {
                  "type": "string"
                },
                "courseId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "courseVersionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "assignmentStatus": {
                  "type": "string"
                },
                "summaryComplete": {
                  "type": "boolean"
                },
                "lessonsTotal": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "lessonsCompleted": {
                  "type": "integer"
                },
                "requiredTotal": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "requiredCompleted": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "awaitingReview": {
                  "type": "boolean"
                },
                "requiredAssessments": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "lessonKey",
                      "passRequired",
                      "manualReview",
                      "status"
                    ],
                    "properties": {
                      "lessonKey": {
                        "type": "string"
                      },
                      "passRequired": {
                        "type": "boolean"
                      },
                      "manualReview": {
                        "type": "boolean"
                      },
                      "status": {
                        "type": "string"
                      }
                    }
                  }
                },
                "evidenceRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/JobOpsEvidenceRef"
                  }
                }
              }
            }
          },
          "payments": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "milestonesNotFunded",
              "milestonesFunded",
              "milestonesEarnedPendingApproval",
              "milestonesApprovedQueued",
              "milestonesTransferred",
              "milestonesFailedManualReview",
              "milestonesCanceled",
              "unresolvedEarned",
              "evidenceRefs"
            ],
            "properties": {
              "milestonesNotFunded": {
                "type": "integer"
              },
              "milestonesFunded": {
                "type": "integer"
              },
              "milestonesEarnedPendingApproval": {
                "type": "integer"
              },
              "milestonesApprovedQueued": {
                "type": "integer"
              },
              "milestonesTransferred": {
                "type": "integer"
              },
              "milestonesFailedManualReview": {
                "type": "integer"
              },
              "milestonesCanceled": {
                "type": "integer"
              },
              "unresolvedEarned": {
                "type": "boolean",
                "description": "Earned/approved work whose settlement is still open on a non-active contract. Funded escrow alone is NOT earned evidence."
              },
              "evidenceRefs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JobOpsEvidenceRef"
                }
              }
            }
          },
          "blockers": {
            "$ref": "#/components/schemas/JobOpsBlockerList"
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          }
        }
      },
      "JobOpsAction": {
        "type": "object",
        "description": "One privacy-safe coordination action with exact claim/lease/dependency/evidence detail.",
        "required": [
          "id",
          "createdAt",
          "updatedAt",
          "titleText",
          "descriptionText",
          "statusText",
          "priorityText",
          "subjectPersonUserId",
          "assignedOwnerText",
          "dueAt",
          "dependsOnJson",
          "evidenceRefsJson",
          "claimOwnerText",
          "claimedByUserId",
          "claimedAt",
          "claimExpiresAt",
          "completedAt",
          "completedByText",
          "outcomeText",
          "canceledAt",
          "canceledByUserId",
          "createdByUserId",
          "sourceSignalId",
          "signalActionAttemptNumber",
          "workExecutionId",
          "handoffReservedForUserId",
          "handoffReservedByUserId",
          "handoffReservationExpiresAt",
          "handoffReservationHandoffId",
          "handoffReservationInstructions",
          "revision"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "titleText": {
            "type": "string"
          },
          "descriptionText": {
            "type": [
              "string",
              "null"
            ]
          },
          "statusText": {
            "type": "string",
            "enum": [
              "OPEN",
              "CLAIMED",
              "COMPLETED",
              "CANCELED"
            ]
          },
          "priorityText": {
            "type": "string",
            "enum": [
              "LOW",
              "NORMAL",
              "HIGH",
              "URGENT"
            ]
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assignedOwnerText": {
            "type": [
              "string",
              "null"
            ]
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dependsOnJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Same-context action ids this action depends on."
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "claimOwnerText": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "claimExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedByText": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcomeText": {
            "type": [
              "string",
              "null"
            ]
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "canceledByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByUserId": {
            "type": "string"
          },
          "sourceSignalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
          },
          "signalActionAttemptNumber": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "workExecutionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
          },
          "handoffReservedForUserId": {
            "type": [
              "string",
              "null"
            ],
            "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
          },
          "handoffReservedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "handoffReservationExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "handoffReservationHandoffId": {
            "type": [
              "string",
              "null"
            ]
          },
          "handoffReservationInstructions": {
            "type": [
              "object",
              "null"
            ],
            "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
            "additionalProperties": false,
            "required": [
              "summary",
              "openItems",
              "evidenceRefs"
            ],
            "properties": {
              "summary": {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000
              },
              "openItems": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2000
                }
              },
              "evidenceRefs": {
                "type": "array",
                "maxItems": 50,
                "items": {
                  "$ref": "#/components/schemas/JobOpsEvidenceRef"
                }
              }
            }
          },
          "revision": {
            "type": "integer",
            "description": "Current action revision — send back as expectedActionRevision."
          }
        }
      },
      "JobOpsActionClaimResult": {
        "type": "object",
        "description": "A claimed privacy-safe action plus its signed receipt and replay marker.",
        "required": [
          "id",
          "createdAt",
          "updatedAt",
          "titleText",
          "descriptionText",
          "statusText",
          "priorityText",
          "subjectPersonUserId",
          "assignedOwnerText",
          "dueAt",
          "dependsOnJson",
          "evidenceRefsJson",
          "claimOwnerText",
          "claimedByUserId",
          "claimedAt",
          "claimExpiresAt",
          "completedAt",
          "completedByText",
          "outcomeText",
          "canceledAt",
          "canceledByUserId",
          "createdByUserId",
          "sourceSignalId",
          "signalActionAttemptNumber",
          "workExecutionId",
          "handoffReservedForUserId",
          "handoffReservedByUserId",
          "handoffReservationExpiresAt",
          "handoffReservationHandoffId",
          "handoffReservationInstructions",
          "revision",
          "claimReceipt",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "titleText": {
            "type": "string"
          },
          "descriptionText": {
            "type": [
              "string",
              "null"
            ]
          },
          "statusText": {
            "type": "string",
            "enum": [
              "OPEN",
              "CLAIMED",
              "COMPLETED",
              "CANCELED"
            ]
          },
          "priorityText": {
            "type": "string",
            "enum": [
              "LOW",
              "NORMAL",
              "HIGH",
              "URGENT"
            ]
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assignedOwnerText": {
            "type": [
              "string",
              "null"
            ]
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dependsOnJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Same-context action ids this action depends on."
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "claimOwnerText": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "claimExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedByText": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcomeText": {
            "type": [
              "string",
              "null"
            ]
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "canceledByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByUserId": {
            "type": "string"
          },
          "sourceSignalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
          },
          "signalActionAttemptNumber": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "workExecutionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
          },
          "handoffReservedForUserId": {
            "type": [
              "string",
              "null"
            ],
            "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
          },
          "handoffReservedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "handoffReservationExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "handoffReservationHandoffId": {
            "type": [
              "string",
              "null"
            ]
          },
          "handoffReservationInstructions": {
            "type": [
              "object",
              "null"
            ],
            "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
            "additionalProperties": false,
            "required": [
              "summary",
              "openItems",
              "evidenceRefs"
            ],
            "properties": {
              "summary": {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000
              },
              "openItems": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2000
                }
              },
              "evidenceRefs": {
                "type": "array",
                "maxItems": 50,
                "items": {
                  "$ref": "#/components/schemas/JobOpsEvidenceRef"
                }
              }
            }
          },
          "revision": {
            "type": "integer",
            "description": "Current action revision — send back as expectedActionRevision."
          },
          "claimReceipt": {
            "type": "string",
            "description": "Signed receipt required by release/complete for this claim."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsDecision": {
        "type": "object",
        "description": "One privacy-safe durable policy/decision/exception record.",
        "required": [
          "id",
          "kindText",
          "titleText",
          "bodyText",
          "visibilityText",
          "scopePersonUserId",
          "gateKeyText",
          "readinessEffectText",
          "effectiveAt",
          "expiresAt",
          "supersedesDecisionId",
          "evidenceRefsJson",
          "createdAt",
          "createdByUserId"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "kindText": {
            "type": "string",
            "enum": [
              "POLICY",
              "DECISION",
              "EXCEPTION"
            ]
          },
          "titleText": {
            "type": "string"
          },
          "bodyText": {
            "type": [
              "string",
              "null"
            ]
          },
          "visibilityText": {
            "type": "string",
            "enum": [
              "INTERNAL",
              "CLIENT_SAFE",
              "WORKER_SAFE"
            ]
          },
          "scopePersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "gateKeyText": {
            "type": [
              "string",
              "null"
            ]
          },
          "readinessEffectText": {
            "type": "string",
            "enum": [
              "NONE",
              "PASS",
              "FAIL",
              "HOLD"
            ]
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "supersedesDecisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "type": "string"
          }
        }
      },
      "JobOpsDecisionHistoryRow": {
        "type": "object",
        "description": "A durable decision plus its effective status at read time.",
        "required": [
          "id",
          "kindText",
          "titleText",
          "bodyText",
          "visibilityText",
          "scopePersonUserId",
          "gateKeyText",
          "readinessEffectText",
          "effectiveAt",
          "expiresAt",
          "supersedesDecisionId",
          "evidenceRefsJson",
          "createdAt",
          "createdByUserId",
          "status"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "kindText": {
            "type": "string",
            "enum": [
              "POLICY",
              "DECISION",
              "EXCEPTION"
            ]
          },
          "titleText": {
            "type": "string"
          },
          "bodyText": {
            "type": [
              "string",
              "null"
            ]
          },
          "visibilityText": {
            "type": "string",
            "enum": [
              "INTERNAL",
              "CLIENT_SAFE",
              "WORKER_SAFE"
            ]
          },
          "scopePersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "gateKeyText": {
            "type": [
              "string",
              "null"
            ]
          },
          "readinessEffectText": {
            "type": "string",
            "enum": [
              "NONE",
              "PASS",
              "FAIL",
              "HOLD"
            ]
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "supersedesDecisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "SUPERSEDED",
              "EXPIRED",
              "SCHEDULED"
            ]
          }
        }
      },
      "JobOpsDecisionHistoryPage": {
        "type": "object",
        "description": "A bounded newest-first page of durable decision history.",
        "required": [
          "contextRevision",
          "decisions",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer"
          },
          "decisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsDecisionHistoryRow"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsObservation": {
        "type": "object",
        "description": "One privacy-safe durable external observation with explicit authority and visibility. A write may add a parsed safe `gateSignal`; raw metadata never crosses the boundary.",
        "required": [
          "id",
          "authorityText",
          "visibilityText",
          "subjectPersonUserId",
          "titleText",
          "bodyText",
          "observedAt",
          "createdAt",
          "createdByUserId",
          "createdByAgentText",
          "evidenceRefsJson"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "authorityText": {
            "type": "string",
            "enum": [
              "OBSERVED",
              "INFERRED",
              "RECOMMENDED"
            ]
          },
          "visibilityText": {
            "type": "string",
            "enum": [
              "INTERNAL",
              "CLIENT_SAFE",
              "WORKER_SAFE"
            ]
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "titleText": {
            "type": "string"
          },
          "bodyText": {
            "type": [
              "string",
              "null"
            ]
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "type": "string"
          },
          "createdByAgentText": {
            "type": [
              "string",
              "null"
            ],
            "description": "DEV-3191 Phase 5 (RC9): canonical executing-agent attribution (server-normalized from actorAgentLabel; null for a human or legacy row)."
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "gateSignal": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsGateSignal"
              },
              {
                "type": "null"
              }
            ]
          },
          "externalAttestation": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsExternalAttestation"
              },
              {
                "type": "null"
              }
            ],
            "description": "Present on the record result: the closed parsed attestation slot, or null (a poisoned stored slot reads null — raw metadata never crosses the boundary)."
          }
        }
      },
      "JobOpsEvent": {
        "type": "object",
        "description": "One append-only operational event at an exact context revision, with sanitized evidence pointers.",
        "required": [
          "id",
          "contextRevision",
          "eventTypeText",
          "sourceDomainText",
          "subjectPersonUserId",
          "evidenceRefsJson",
          "createdAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "contextRevision": {
            "type": "integer"
          },
          "eventTypeText": {
            "type": "string"
          },
          "sourceDomainText": {
            "type": "string",
            "enum": [
              "PROPOSAL",
              "CONTRACT",
              "IDENTITY",
              "TODO",
              "TRAINING",
              "MESSAGE",
              "PAYMENT",
              "PROVIDER",
              "OPS"
            ]
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobOpsEventDeltaPage": {
        "type": "object",
        "description": "One closed revision-cursor page. Events use the same privacy-safe shape as full-context recentEvents.",
        "required": [
          "contextRevision",
          "events",
          "hasMore",
          "nextRevision"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "description": "Current head revision of the context."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvent"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextRevision": {
            "type": "integer",
            "description": "The last revision actually delivered in this page — the safe resume point."
          }
        }
      },
      "JobOpsBrief": {
        "type": "object",
        "description": "One privacy-safe published brief revision.",
        "required": [
          "id",
          "briefRevision",
          "objectiveText",
          "workflowDefinitionJson",
          "createdAt",
          "createdByUserId"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "briefRevision": {
            "type": "integer"
          },
          "objectiveText": {
            "type": "string"
          },
          "workflowDefinitionJson": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkflowDefinition"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "type": "string"
          }
        }
      },
      "JobOpsCheckpoint": {
        "type": "object",
        "description": "One privacy-safe delta-cursor acknowledgement. Checkpoints never advance the context revision.",
        "required": [
          "id",
          "acknowledgedRevision",
          "actorUserId",
          "actorAgentText",
          "noteText",
          "createdAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "acknowledgedRevision": {
            "type": "integer"
          },
          "actorUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "actorAgentText": {
            "type": [
              "string",
              "null"
            ]
          },
          "noteText": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobOpsHandoff": {
        "type": "object",
        "description": "One privacy-safe structured handoff. contextRevision is the revision the departing actor had seen; the handoff event advances the context one step past it.",
        "required": [
          "id",
          "fromActorUserId",
          "fromActorAgentText",
          "toActorUserId",
          "toActorAgentText",
          "summaryText",
          "openItemsJson",
          "contextRevision",
          "evidenceRefsJson",
          "createdAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "fromActorUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fromActorAgentText": {
            "type": [
              "string",
              "null"
            ]
          },
          "toActorUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "toActorAgentText": {
            "type": [
              "string",
              "null"
            ]
          },
          "summaryText": {
            "type": "string"
          },
          "openItemsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "contextRevision": {
            "type": "integer"
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobOpsSweepResult": {
        "type": "object",
        "description": "Bounded idempotent sweep receipt. The resume cursor is durable and server-owned; while hasMore=true call sweep again with this contextRevision, then read context again.",
        "required": [
          "contextRevision",
          "scanned",
          "advanced",
          "replayed",
          "skipped",
          "lastEventId",
          "cursor",
          "hasMore",
          "driftAdvanced",
          "driftReplayed"
        ],
        "properties": {
          "contextRevision": {
            "type": "integer",
            "description": "Context revision observed after this bounded sweep — use it for the next continuation call."
          },
          "scanned": {
            "type": "integer"
          },
          "advanced": {
            "type": "integer"
          },
          "replayed": {
            "type": "integer"
          },
          "skipped": {
            "type": "integer"
          },
          "lastEventId": {
            "type": [
              "string",
              "null"
            ],
            "description": "High-water mark of every scanned outbox row; null when the page was empty."
          },
          "cursor": {
            "type": "string",
            "description": "The durable server-owned outbox cursor after this sweep (informational)."
          },
          "hasMore": {
            "type": "boolean"
          },
          "driftAdvanced": {
            "type": "integer"
          },
          "driftReplayed": {
            "type": "integer"
          }
        }
      },
      "JobOpsContextSnapshot": {
        "type": "object",
        "description": "One coherent evidence-backed context snapshot at exactly `contextRevision`. view=compact returns JobOpsPersonSummary roster entries; view=full returns JobOpsPersonProjection entries plus recentEvents/recentEventsComplete.",
        "required": [
          "jobId",
          "contextExists",
          "contextRevision",
          "collectedAt",
          "brief",
          "workflow",
          "activeDecisions",
          "activeDecisionsComplete",
          "latestCheckpoint",
          "latestHandoff",
          "counts",
          "inconsistencies",
          "responseSignals",
          "attention",
          "policies",
          "guide",
          "openActions",
          "openActionsComplete",
          "recentObservations",
          "recentObservationsComplete",
          "persons",
          "personsTotal",
          "personsComplete",
          "nextPersonCursor"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "contextExists": {
            "type": "boolean"
          },
          "contextRevision": {
            "type": "integer"
          },
          "collectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "brief": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "id",
              "briefRevision",
              "objectiveText"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "briefRevision": {
                "type": "integer"
              },
              "objectiveText": {
                "type": "string"
              }
            }
          },
          "workflow": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkflowDefinition"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when no workflow is defined OR the stored definition is invalid; the INVALID_WORKFLOW_DEFINITION inconsistency distinguishes which."
          },
          "activeDecisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsDecision"
            }
          },
          "activeDecisionsComplete": {
            "type": "boolean"
          },
          "latestCheckpoint": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsCheckpoint"
              },
              {
                "type": "null"
              }
            ]
          },
          "latestHandoff": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsHandoff"
              },
              {
                "type": "null"
              }
            ]
          },
          "counts": {
            "type": "object",
            "required": [
              "submittedProposals",
              "openInvitations",
              "activeContracts",
              "milestonesActive",
              "milestonesPendingApproval",
              "workerObligationsOpen",
              "trainingObligationsOpen",
              "conversationsNeedingResponse",
              "providersConfigured"
            ],
            "properties": {
              "submittedProposals": {
                "type": "integer"
              },
              "openInvitations": {
                "type": "integer"
              },
              "activeContracts": {
                "type": "integer"
              },
              "milestonesActive": {
                "type": "integer"
              },
              "milestonesPendingApproval": {
                "type": "integer"
              },
              "workerObligationsOpen": {
                "type": "integer"
              },
              "trainingObligationsOpen": {
                "type": "integer"
              },
              "conversationsNeedingResponse": {
                "type": "integer"
              },
              "providersConfigured": {
                "type": "integer"
              }
            }
          },
          "inconsistencies": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code",
                "evidenceRefs"
              ],
              "properties": {
                "code": {
                  "type": "string"
                },
                "evidenceRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/JobOpsEvidenceRef"
                  }
                }
              }
            }
          },
          "responseSignals": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "conversationId",
                "threadId",
                "needsEmployerResponse",
                "lastMessageAt",
                "evidenceRefs"
              ],
              "properties": {
                "conversationId": {
                  "type": "string"
                },
                "threadId": {
                  "type": "string"
                },
                "needsEmployerResponse": {
                  "type": "boolean"
                },
                "lastMessageAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "evidenceRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/JobOpsEvidenceRef"
                  }
                }
              }
            }
          },
          "attention": {
            "type": "object",
            "description": "Bounded deterministic attention block (86d45zzzq): top 10 ACTIVE+FRESH actionable priorities (SHADOW rules excluded at the database query level; dismissed/live-snoozed triage excluded), full count metadata, and per-rule evaluator cursor health. STALE/INCOMPLETE conditions stay visible in the counts/health metadata but are never presented as actionable priorities.",
            "required": [
              "top",
              "topComplete",
              "counts",
              "ruleHealth",
              "shadowExcluded"
            ],
            "additionalProperties": false,
            "properties": {
              "top": {
                "type": "array",
                "maxItems": 10,
                "items": {
                  "type": "object",
                  "required": [
                    "signalId",
                    "ruleKey",
                    "title",
                    "summary",
                    "priorityBand",
                    "priorityScore",
                    "freshness",
                    "effectiveTriage",
                    "occurrenceNumber",
                    "occurrenceStartedAt",
                    "lastEvaluatedAt",
                    "subjectPersonUserId",
                    "signalRevision",
                    "latestAction"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "signalId": {
                      "type": "string"
                    },
                    "ruleKey": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "priorityBand": {
                      "type": "string",
                      "enum": [
                        "P0",
                        "P1",
                        "P2",
                        "P3"
                      ]
                    },
                    "priorityScore": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "freshness": {
                      "type": "string",
                      "enum": [
                        "FRESH"
                      ]
                    },
                    "effectiveTriage": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED"
                      ],
                      "description": "Only actionable triage appears here."
                    },
                    "occurrenceNumber": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "occurrenceStartedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "lastEvaluatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "signalRevision": {
                      "type": "integer",
                      "description": "Send back as expectedSignalRevision on signal mutations."
                    },
                    "latestAction": {
                      "oneOf": [
                        {
                          "type": "object",
                          "description": "Derived ownership: the latest linked action attempt.",
                          "required": [
                            "actionId",
                            "status",
                            "attemptNumber",
                            "claimOwner",
                            "claimedByUserId",
                            "claimedAt",
                            "claimExpiresAt"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "actionId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "OPEN",
                                "CLAIMED",
                                "COMPLETED",
                                "CANCELED"
                              ]
                            },
                            "attemptNumber": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 1
                            },
                            "claimOwner": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "claimedByUserId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "claimedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "claimExpiresAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              },
              "topComplete": {
                "type": "boolean"
              },
              "counts": {
                "type": "object",
                "required": [
                  "byCondition",
                  "activeByBand",
                  "activeByFreshness",
                  "activeByEffectiveTriage"
                ],
                "additionalProperties": false,
                "properties": {
                  "byCondition": {
                    "type": "object",
                    "required": [
                      "ACTIVE",
                      "CLEARED"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "ACTIVE": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "CLEARED": {
                        "type": "integer",
                        "minimum": 0
                      }
                    }
                  },
                  "activeByBand": {
                    "type": "object",
                    "required": [
                      "P0",
                      "P1",
                      "P2",
                      "P3"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "P0": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "P1": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "P2": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "P3": {
                        "type": "integer",
                        "minimum": 0
                      }
                    }
                  },
                  "activeByFreshness": {
                    "type": "object",
                    "required": [
                      "FRESH",
                      "STALE",
                      "INCOMPLETE"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "FRESH": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "STALE": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "INCOMPLETE": {
                        "type": "integer",
                        "minimum": 0
                      }
                    }
                  },
                  "activeByEffectiveTriage": {
                    "type": "object",
                    "required": [
                      "OPEN",
                      "ACKNOWLEDGED",
                      "SNOOZED",
                      "DISMISSED"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "OPEN": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "ACKNOWLEDGED": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "SNOOZED": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "DISMISSED": {
                        "type": "integer",
                        "minimum": 0
                      }
                    }
                  }
                }
              },
              "ruleHealth": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "ruleKey",
                    "ruleVersion",
                    "health",
                    "scanComplete",
                    "lastStartedAt",
                    "lastSuccessAt",
                    "lastFailureAt",
                    "consecutiveFailures",
                    "lastErrorCode",
                    "shadow"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "ruleKey": {
                      "type": "string"
                    },
                    "ruleVersion": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "health": {
                      "type": "string",
                      "enum": [
                        "HEALTHY",
                        "STALE",
                        "INCOMPLETE"
                      ],
                      "description": "Projected at read time from the stored cursor and the rule freshness SLA: a rule with no complete scan inside its SLA (INCOMPLETE too long, or still failing) or not started within its SLA plus a fixed 2-hour scheduling grace reads STALE. Stored evaluator state is never rewritten by a read."
                    },
                    "healthReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "FAILING",
                        "INCOMPLETE_TOO_LONG",
                        "NOT_EVALUATED_RECENTLY",
                        "SCAN_IN_PROGRESS",
                        "INCOMPLETE_SOURCES",
                        "UNSUPPORTED",
                        "SCAN_INCOMPLETE",
                        null
                      ],
                      "description": "Present only when the request opts in with header `x-opentrain-job-ops-capabilities: rule-health-reasons` (omitted otherwise so already-published strict clients keep parsing). Why health is what it is (null = HEALTHY with no failure). FAILING = the latest evaluation failed (see consecutiveFailures/lastErrorCode; STALE once past the SLA); INCOMPLETE_TOO_LONG = STALE, the evaluator runs but no complete scan landed within the SLA; NOT_EVALUATED_RECENTLY = STALE, the evaluator has not started the rule recently (scheduling); SCAN_IN_PROGRESS / INCOMPLETE_SOURCES / UNSUPPORTED / SCAN_INCOMPLETE = INCOMPLETE inside the SLA. The enum is closed for this capability: any new value ships behind a NEW capability token, so a client that sent only `rule-health-reasons` never receives it."
                    },
                    "scanComplete": {
                      "type": "boolean"
                    },
                    "lastStartedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "lastSuccessAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "lastFailureAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "consecutiveFailures": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "lastErrorCode": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Privacy-safe error class only — never payloads."
                    },
                    "incompleteSourceCounts": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Present only with the `rule-health-reasons` capability header (see healthReason). Source records the last finished scan could not read, as privacy-safe reason code -> count (never ids, answers, or names); null when none are stored. Distinguishes a data/classification problem from a scan delay. The code set is closed for this capability: any new code ships behind a NEW capability token, so a client that sent only `rule-health-reasons` never receives it.",
                      "additionalProperties": false,
                      "properties": {
                        "FORM_DEFINITION_UNPARSEABLE": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "FORM_DEFINITION_MISSING": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "GRADE_RECORD_INVALID": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "GRADE_RECORD_MISSING": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    },
                    "shadow": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "shadowExcluded": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            }
          },
          "policies": {
            "type": "object",
            "description": "Effective typed-policy summary (fail closed: complete=false with an empty effective set when history exceeded the bounded read — use the policies endpoints for detail).",
            "required": [
              "complete",
              "effective",
              "storedInvalidKeys",
              "legacyUntypedPolicyCount",
              "pendingExternalEnforcementKeys"
            ],
            "additionalProperties": false,
            "properties": {
              "complete": {
                "type": "boolean"
              },
              "effective": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "key",
                    "family",
                    "policyRevision",
                    "schemaVersion",
                    "enforcementTarget",
                    "enforcementStatus",
                    "decisionId",
                    "supersedesDecisionId",
                    "effectiveAt",
                    "expiresAt"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "family": {
                      "type": "string",
                      "enum": [
                        "OPERATING_RULE",
                        "TRAINING_PRODUCTION_GATE",
                        "WORKFLOW_GATE_RULE",
                        "WORK_DEFINITION_APPROVAL",
                        "WORK_DUPLICATE_RESOLUTION",
                        "WORK_COORDINATION_MODE"
                      ]
                    },
                    "policyRevision": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "schemaVersion": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "enforcementTarget": {
                      "type": "string",
                      "enum": [
                        "GUIDE",
                        "WORKFLOW",
                        "CANONICAL_DB",
                        "EXTERNAL"
                      ]
                    },
                    "enforcementStatus": {
                      "type": "string",
                      "enum": [
                        "APPLIED",
                        "PENDING_ENFORCEMENT",
                        "DRIFTED",
                        "NOT_APPLICABLE"
                      ]
                    },
                    "decisionId": {
                      "type": "string"
                    },
                    "supersedesDecisionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    }
                  }
                }
              },
              "storedInvalidKeys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "legacyUntypedPolicyCount": {
                "type": "integer",
                "minimum": 0
              },
              "pendingExternalEnforcementKeys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "guide": {
            "type": "object",
            "description": "Agent Guide digest (canonical projection guideVersion + checksum) computed from the same fenced reads as this snapshot: fetch the agent-guide endpoint for the full document; compare checksums to detect change.",
            "required": [
              "schemaVersion",
              "guideVersion",
              "checksum",
              "lastMaterialChangeAt"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "guideVersion": {
                "type": "integer"
              },
              "checksum": {
                "type": "string"
              },
              "lastMaterialChangeAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "openActions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsAction"
            }
          },
          "openActionsComplete": {
            "type": "boolean"
          },
          "recentObservations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsObservation"
            }
          },
          "recentObservationsComplete": {
            "type": "boolean"
          },
          "recentEvents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvent"
            },
            "description": "view=full only."
          },
          "recentEventsComplete": {
            "type": "boolean",
            "description": "view=full only."
          },
          "persons": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/JobOpsPersonSummary"
                },
                {
                  "$ref": "#/components/schemas/JobOpsPersonProjection"
                }
              ]
            }
          },
          "personsTotal": {
            "type": "integer",
            "description": "Full-roster size; counts/summaries always reflect the full roster."
          },
          "personsComplete": {
            "type": "boolean"
          },
          "nextPersonCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsPersonDetail": {
        "type": "object",
        "description": "One evidence-backed person read at a coherent contextRevision, with scoped open/claimed actions and scoped active decisions.",
        "required": [
          "jobId",
          "contextRevision",
          "collectedAt",
          "person",
          "actions",
          "actionsComplete",
          "decisions",
          "decisionsComplete",
          "observationsComplete"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "contextRevision": {
            "type": "integer"
          },
          "collectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "person": {
            "$ref": "#/components/schemas/JobOpsPersonProjection"
          },
          "actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsAction"
            }
          },
          "actionsComplete": {
            "type": "boolean"
          },
          "decisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsDecision"
            }
          },
          "decisionsComplete": {
            "type": "boolean"
          },
          "observationsComplete": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSignalPriorityBreakdown": {
        "type": "object",
        "description": "Reproducible additive priority: exact factor inputs, the pre-floor base score, and the applied safety floor (if any) with its reviewed reason. No multiplicative score exists.",
        "required": [
          "factors",
          "baseScore",
          "safetyFloor"
        ],
        "additionalProperties": false,
        "properties": {
          "factors": {
            "type": "object",
            "required": [
              "impact",
              "urgency",
              "breadth",
              "recurrence",
              "confidence"
            ],
            "additionalProperties": false,
            "properties": {
              "impact": {
                "type": "integer",
                "minimum": 0,
                "maximum": 40
              },
              "urgency": {
                "type": "integer",
                "minimum": 0,
                "maximum": 25
              },
              "breadth": {
                "type": "integer",
                "minimum": 0,
                "maximum": 15
              },
              "recurrence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10
              },
              "confidence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10
              }
            }
          },
          "baseScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "safetyFloor": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "band",
                  "reason"
                ],
                "additionalProperties": false,
                "properties": {
                  "band": {
                    "type": "string",
                    "enum": [
                      "P0",
                      "P1",
                      "P2",
                      "P3"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsSignal": {
        "type": "object",
        "description": "One durable attention-signal head: a persistent DERIVED primitive produced only by deterministic rule evaluation over canonical evidence. State is three independent axes — condition (evaluator-owned), freshness (evaluator-health-owned), triage (manager/agent-owned). Ownership is derived from the latest linked action, never a triage value. Presented rows carry canonical ids, safe titles/summaries, scores/factors, timestamps, statuses, and evidence references — never message bodies, answers, or provider secrets.",
        "required": [
          "id",
          "createdAt",
          "updatedAt",
          "ruleKeyText",
          "ruleVersion",
          "fingerprintText",
          "conditionText",
          "freshnessText",
          "triageText",
          "occurrenceNumber",
          "occurrenceStartedAt",
          "firstDetectedAt",
          "lastDetectedAt",
          "clearedAt",
          "titleText",
          "summaryText",
          "subjectPersonUserId",
          "priorityScore",
          "priorityBandText",
          "priorityFactorsJson",
          "safetyFloorBandText",
          "evaluationHashText",
          "lastEvaluatedAt",
          "evidenceRefsJson",
          "triagedAt",
          "triagedByUserId",
          "triagedByAgentText",
          "triageReasonText",
          "snoozedUntil",
          "triageEvaluationHashText",
          "triagePriorityBandText",
          "revision",
          "effectiveTriageText"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "ruleKeyText": {
            "type": "string",
            "maxLength": 120
          },
          "ruleVersion": {
            "type": "integer",
            "minimum": 1
          },
          "fingerprintText": {
            "type": "string"
          },
          "conditionText": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "CLEARED"
            ]
          },
          "freshnessText": {
            "type": "string",
            "enum": [
              "FRESH",
              "STALE",
              "INCOMPLETE"
            ]
          },
          "triageText": {
            "type": "string",
            "enum": [
              "OPEN",
              "ACKNOWLEDGED",
              "SNOOZED",
              "DISMISSED"
            ]
          },
          "occurrenceNumber": {
            "type": "integer",
            "minimum": 1
          },
          "occurrenceStartedAt": {
            "type": "string",
            "format": "date-time"
          },
          "firstDetectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastDetectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "clearedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "titleText": {
            "type": "string"
          },
          "summaryText": {
            "type": "string"
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "priorityScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "priorityBandText": {
            "type": "string",
            "enum": [
              "P0",
              "P1",
              "P2",
              "P3"
            ]
          },
          "priorityFactorsJson": {
            "$ref": "#/components/schemas/JobOpsSignalPriorityBreakdown"
          },
          "safetyFloorBandText": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "P0",
                  "P1",
                  "P2",
                  "P3"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "evaluationHashText": {
            "type": "string"
          },
          "lastEvaluatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "evidenceRefsJson": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "triagedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "triagedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "triagedByAgentText": {
            "type": [
              "string",
              "null"
            ]
          },
          "triageReasonText": {
            "type": [
              "string",
              "null"
            ]
          },
          "snoozedUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "triageEvaluationHashText": {
            "type": [
              "string",
              "null"
            ]
          },
          "triagePriorityBandText": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "P0",
                  "P1",
                  "P2",
                  "P3"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "description": "Current signal revision — send back as expectedSignalRevision."
          },
          "effectiveTriageText": {
            "type": "string",
            "enum": [
              "OPEN",
              "ACKNOWLEDGED",
              "SNOOZED",
              "DISMISSED"
            ],
            "description": "Derived read-time triage: an expired snooze reads as OPEN without a write."
          }
        }
      },
      "JobOpsSignalTriageResult": {
        "type": "object",
        "description": "The exact presented signal row plus the idempotency replay marker.",
        "required": [
          "id",
          "createdAt",
          "updatedAt",
          "ruleKeyText",
          "ruleVersion",
          "fingerprintText",
          "conditionText",
          "freshnessText",
          "triageText",
          "occurrenceNumber",
          "occurrenceStartedAt",
          "firstDetectedAt",
          "lastDetectedAt",
          "clearedAt",
          "titleText",
          "summaryText",
          "subjectPersonUserId",
          "priorityScore",
          "priorityBandText",
          "priorityFactorsJson",
          "safetyFloorBandText",
          "evaluationHashText",
          "lastEvaluatedAt",
          "evidenceRefsJson",
          "triagedAt",
          "triagedByUserId",
          "triagedByAgentText",
          "triageReasonText",
          "snoozedUntil",
          "triageEvaluationHashText",
          "triagePriorityBandText",
          "revision",
          "effectiveTriageText",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "ruleKeyText": {
            "type": "string",
            "maxLength": 120
          },
          "ruleVersion": {
            "type": "integer",
            "minimum": 1
          },
          "fingerprintText": {
            "type": "string"
          },
          "conditionText": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "CLEARED"
            ]
          },
          "freshnessText": {
            "type": "string",
            "enum": [
              "FRESH",
              "STALE",
              "INCOMPLETE"
            ]
          },
          "triageText": {
            "type": "string",
            "enum": [
              "OPEN",
              "ACKNOWLEDGED",
              "SNOOZED",
              "DISMISSED"
            ]
          },
          "occurrenceNumber": {
            "type": "integer",
            "minimum": 1
          },
          "occurrenceStartedAt": {
            "type": "string",
            "format": "date-time"
          },
          "firstDetectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastDetectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "clearedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "titleText": {
            "type": "string"
          },
          "summaryText": {
            "type": "string"
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "priorityScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "priorityBandText": {
            "type": "string",
            "enum": [
              "P0",
              "P1",
              "P2",
              "P3"
            ]
          },
          "priorityFactorsJson": {
            "$ref": "#/components/schemas/JobOpsSignalPriorityBreakdown"
          },
          "safetyFloorBandText": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "P0",
                  "P1",
                  "P2",
                  "P3"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "evaluationHashText": {
            "type": "string"
          },
          "lastEvaluatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "evidenceRefsJson": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "triagedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "triagedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "triagedByAgentText": {
            "type": [
              "string",
              "null"
            ]
          },
          "triageReasonText": {
            "type": [
              "string",
              "null"
            ]
          },
          "snoozedUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "triageEvaluationHashText": {
            "type": [
              "string",
              "null"
            ]
          },
          "triagePriorityBandText": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "P0",
                  "P1",
                  "P2",
                  "P3"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "description": "Current signal revision — send back as expectedSignalRevision."
          },
          "effectiveTriageText": {
            "type": "string",
            "enum": [
              "OPEN",
              "ACKNOWLEDGED",
              "SNOOZED",
              "DISMISSED"
            ],
            "description": "Derived read-time triage: an expired snooze reads as OPEN without a write."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSignalPage": {
        "type": "object",
        "description": "One bounded signal page, highest priority first. SHADOW-rule signals are omitted at the database query level unless includeShadow=true.",
        "required": [
          "contextRevision",
          "signals",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer"
          },
          "signals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsSignal"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsSignalDetail": {
        "type": "object",
        "description": "Signal detail plus the latest linked action attempt — the derived owner/claim state.",
        "required": [
          "contextRevision",
          "signal",
          "latestAction"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer"
          },
          "signal": {
            "$ref": "#/components/schemas/JobOpsSignal"
          },
          "latestAction": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "id",
                  "statusText",
                  "signalActionAttemptNumber",
                  "claimOwnerText",
                  "claimedByUserId",
                  "claimedAt",
                  "claimExpiresAt",
                  "completedAt",
                  "canceledAt",
                  "revision"
                ],
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "statusText": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "CLAIMED",
                      "COMPLETED",
                      "CANCELED"
                    ]
                  },
                  "signalActionAttemptNumber": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1
                  },
                  "claimOwnerText": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "claimedByUserId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "claimedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "claimExpiresAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "completedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "canceledAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "revision": {
                    "type": "integer"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsSignalClaimResult": {
        "type": "object",
        "description": "Atomic signal→action claim result: the claimed (created or reused) action attempt with its signed claim receipt. The signal row itself is untouched — ownership is derived from this action.",
        "required": [
          "action",
          "claimReceipt",
          "attemptNumber",
          "created",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "$ref": "#/components/schemas/JobOpsAction"
          },
          "claimReceipt": {
            "type": "string",
            "description": "Signed receipt required by action release/complete for this claim."
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 1
          },
          "created": {
            "type": "boolean",
            "description": "True when this claim created a NEW action attempt (max + 1)."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsTypedPolicyPayload": {
        "description": "Typed policy contract v1 payloads. The versioned registry validates payloads in depth; unknown fields fail closed.",
        "oneOf": [
          {
            "type": "object",
            "description": "OPERATING_RULE: a positive instruction or a prohibition.",
            "required": [
              "schemaVersion",
              "kind",
              "statement"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "REQUIREMENT",
                  "PROHIBITION"
                ]
              },
              "statement": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "rationale": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "TRAINING_PRODUCTION_GATE: canonical training readiness basis.",
            "required": [
              "schemaVersion",
              "basis"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "basis": {
                "type": "string",
                "enum": [
                  "COURSE_COMPLETION",
                  "SCORED_ASSESSMENTS"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "WORKFLOW_GATE_RULE: required/blocking/override behavior of one existing workflow gate.",
            "required": [
              "schemaVersion",
              "gateKey",
              "required",
              "blocking",
              "overrideAllowed"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "gateKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "required": {
                "type": "boolean"
              },
              "blocking": {
                "type": "boolean"
              },
              "overrideAllowed": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "WORK_DEFINITION_APPROVAL (C-DEV3191-060/075): a HUMAN job-manager approval of exact work-definition semantics — recorded only by a non-agent principal proven in the exact job court (the organization owner or a current member assigned to the job; agent principals are refused); DECIDED versions reference it.",
            "required": [
              "schemaVersion",
              "definitionKey",
              "contentHash",
              "coordinationSignature"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "definitionKey": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
              },
              "contentHash": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "coordinationSignature": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          },
          {
            "type": "object",
            "description": "WORK_DUPLICATE_RESOLUTION (RC10, C-DEV3191-079/083/087) — DISTINCT: a HUMAN job-manager judgement that one possible-duplicate pair is distinct, bound to the EXACT latest version bindings of both definitions (a moved binding is refused as stale). Key: WORK_DUPLICATE_RESOLUTION.<first>.<second> with the pair in canonical (code-unit) order; the payload keys carry the same order. No winner is named.",
            "required": [
              "schemaVersion",
              "definitionKey",
              "candidateDefinitionKey",
              "outcome",
              "definitionBinding",
              "candidateBinding"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "definitionKey": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
              },
              "candidateDefinitionKey": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "DISTINCT"
                ]
              },
              "definitionBinding": {
                "type": "object",
                "required": [
                  "versionNumber",
                  "contentHash",
                  "coordinationSignature"
                ],
                "additionalProperties": false,
                "properties": {
                  "versionNumber": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "contentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "coordinationSignature": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              },
              "candidateBinding": {
                "type": "object",
                "required": [
                  "versionNumber",
                  "contentHash",
                  "coordinationSignature"
                ],
                "additionalProperties": false,
                "properties": {
                  "versionNumber": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "contentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "coordinationSignature": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "WORK_DUPLICATE_RESOLUTION — DUPLICATE: the same pair judged duplicates; `selectedDefinitionKey` (exactly one of the pair) is the definition that stays, the other is the retired proposal. The retired side can no longer be approved, appended as DECIDED, or activated, and a selected proposal cannot activate while the retired definition is still ACTIVE, until a human archives the retired definition or supersedes this resolution. Nothing is merged or rewritten.",
            "required": [
              "schemaVersion",
              "definitionKey",
              "candidateDefinitionKey",
              "outcome",
              "selectedDefinitionKey",
              "definitionBinding",
              "candidateBinding"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "definitionKey": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
              },
              "candidateDefinitionKey": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "DUPLICATE"
                ]
              },
              "selectedDefinitionKey": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
              },
              "definitionBinding": {
                "type": "object",
                "required": [
                  "versionNumber",
                  "contentHash",
                  "coordinationSignature"
                ],
                "additionalProperties": false,
                "properties": {
                  "versionNumber": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "contentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "coordinationSignature": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              },
              "candidateBinding": {
                "type": "object",
                "required": [
                  "versionNumber",
                  "contentHash",
                  "coordinationSignature"
                ],
                "additionalProperties": false,
                "properties": {
                  "versionNumber": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "contentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "coordinationSignature": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "WORK_COORDINATION_MODE (DEV-3191 Phase 5, RC9): a HUMAN job-manager declaration of how strictly this job requires declared work — a singleton key with no qualifier. OPEN (default when no row exists): the catalog is advisory. COORDINATED: every guarded mutation must present a claimed action bound to an OPEN work execution (defined or provisional). MANAGED: that execution must be DEFINED work under an ACTIVE definition. The effective mode is read on every covered response as workCatalog.coordination; an unreadable lineage is fail-closed, never OPEN.",
            "required": [
              "schemaVersion",
              "mode"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "OPEN",
                  "COORDINATED",
                  "MANAGED"
                ]
              },
              "rationale": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            }
          }
        ]
      },
      "JobOpsTypedPolicyRow": {
        "type": "object",
        "description": "One append-only typed-policy decision revision. Enforcement status is a record-time fact on append-only rows; live external drift surfaces through the drift signal, never by editing rows in place.",
        "required": [
          "id",
          "kindText",
          "createdAt",
          "effectiveAt",
          "expiresAt",
          "supersedesDecisionId",
          "policyKeyText",
          "policySchemaVersion",
          "policyPayloadJson",
          "payloadValid",
          "policyRevision",
          "policyEnforcementTargetText",
          "policyEnforcementStatusText",
          "createdByUserId",
          "createdByAgentText",
          "approvedByUserId",
          "approvedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "kindText": {
            "type": "string",
            "enum": [
              "POLICY"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "supersedesDecisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "policyKeyText": {
            "type": "string",
            "maxLength": 200
          },
          "policySchemaVersion": {
            "type": "integer",
            "minimum": 1
          },
          "policyPayloadJson": {
            "description": "Privacy-safe payload: present as the exact closed typed shape only when the stored payload still parses against the versioned registry (payloadValid: true). Stored-invalid or legacy-malformed history rows read as null — raw persisted JSON of unknown shape never crosses the public boundary.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsTypedPolicyPayload"
              },
              {
                "type": "null"
              }
            ]
          },
          "payloadValid": {
            "type": "boolean",
            "description": "True when policyPayloadJson carries the validated typed payload; false marks a stored-invalid/legacy row (readable metadata, payload withheld, never enforced)."
          },
          "policyRevision": {
            "type": "integer",
            "minimum": 1
          },
          "policyEnforcementTargetText": {
            "type": "string",
            "enum": [
              "GUIDE",
              "WORKFLOW",
              "CANONICAL_DB",
              "EXTERNAL"
            ]
          },
          "policyEnforcementStatusText": {
            "type": "string",
            "enum": [
              "APPLIED",
              "PENDING_ENFORCEMENT",
              "DRIFTED",
              "NOT_APPLICABLE"
            ]
          },
          "createdByUserId": {
            "type": "string"
          },
          "createdByAgentText": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "JobOpsEffectiveTypedPolicy": {
        "type": "object",
        "description": "One currently-effective typed policy (active head of its key lineage) with validated payload, guide projection, and full author/agent/approver attribution.",
        "required": [
          "key",
          "family",
          "qualifier",
          "payload",
          "projection",
          "decisionId",
          "policyRevision",
          "schemaVersion",
          "enforcementTarget",
          "enforcementStatus",
          "effectiveAt",
          "expiresAt",
          "supersedesDecisionId",
          "createdByUserId",
          "createdByAgentText",
          "approvedByUserId",
          "approvedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 200
          },
          "family": {
            "type": "string",
            "enum": [
              "OPERATING_RULE",
              "TRAINING_PRODUCTION_GATE",
              "WORKFLOW_GATE_RULE",
              "WORK_DEFINITION_APPROVAL",
              "WORK_DUPLICATE_RESOLUTION",
              "WORK_COORDINATION_MODE"
            ]
          },
          "qualifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "payload": {
            "$ref": "#/components/schemas/JobOpsTypedPolicyPayload"
          },
          "projection": {
            "description": "Safe structured guide projection of the payload — typed fields only.",
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "family",
                  "kind",
                  "statement",
                  "rationale"
                ],
                "additionalProperties": false,
                "properties": {
                  "family": {
                    "type": "string",
                    "enum": [
                      "OPERATING_RULE"
                    ]
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "REQUIREMENT",
                      "PROHIBITION"
                    ]
                  },
                  "statement": {
                    "type": "string"
                  },
                  "rationale": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "family",
                  "basis",
                  "gradingReviewRequiredBeforeReadiness"
                ],
                "additionalProperties": false,
                "properties": {
                  "family": {
                    "type": "string",
                    "enum": [
                      "TRAINING_PRODUCTION_GATE"
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "COURSE_COMPLETION",
                      "SCORED_ASSESSMENTS"
                    ]
                  },
                  "gradingReviewRequiredBeforeReadiness": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "family",
                  "gateKey",
                  "required",
                  "blocking",
                  "overrideAllowed"
                ],
                "additionalProperties": false,
                "properties": {
                  "family": {
                    "type": "string",
                    "enum": [
                      "WORKFLOW_GATE_RULE"
                    ]
                  },
                  "gateKey": {
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "blocking": {
                    "type": "boolean"
                  },
                  "overrideAllowed": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "family",
                  "definitionKey",
                  "contentHash",
                  "coordinationSignature"
                ],
                "additionalProperties": false,
                "properties": {
                  "family": {
                    "type": "string",
                    "enum": [
                      "WORK_DEFINITION_APPROVAL"
                    ]
                  },
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "contentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "coordinationSignature": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "family",
                  "definitionKey",
                  "candidateDefinitionKey",
                  "outcome",
                  "selectedDefinitionKey"
                ],
                "additionalProperties": false,
                "properties": {
                  "family": {
                    "type": "string",
                    "enum": [
                      "WORK_DUPLICATE_RESOLUTION"
                    ]
                  },
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "candidateDefinitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "DISTINCT",
                      "DUPLICATE"
                    ]
                  },
                  "selectedDefinitionKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "DUPLICATE: the selected existing definition; DISTINCT: null."
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "family",
                  "mode",
                  "rationale"
                ],
                "additionalProperties": false,
                "properties": {
                  "family": {
                    "type": "string",
                    "enum": [
                      "WORK_COORDINATION_MODE"
                    ]
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "COORDINATED",
                      "MANAGED"
                    ]
                  },
                  "rationale": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            ]
          },
          "decisionId": {
            "type": "string"
          },
          "policyRevision": {
            "type": "integer",
            "minimum": 1
          },
          "schemaVersion": {
            "type": "integer",
            "minimum": 1
          },
          "enforcementTarget": {
            "type": "string",
            "enum": [
              "GUIDE",
              "WORKFLOW",
              "CANONICAL_DB",
              "EXTERNAL"
            ]
          },
          "enforcementStatus": {
            "type": "string",
            "enum": [
              "APPLIED",
              "PENDING_ENFORCEMENT",
              "DRIFTED",
              "NOT_APPLICABLE"
            ]
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "supersedesDecisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByUserId": {
            "type": "string"
          },
          "createdByAgentText": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "JobOpsEffectivePolicyState": {
        "type": "object",
        "description": "The effective typed policies (active head per key). Fail closed: when history exceeds the bounded authoritative read, complete=false and effective is intentionally empty — page the policy history instead.",
        "required": [
          "contextRevision",
          "complete",
          "effective",
          "storedInvalid",
          "legacyUntypedPolicyCount"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer"
          },
          "complete": {
            "type": "boolean"
          },
          "effective": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEffectiveTypedPolicy"
            }
          },
          "storedInvalid": {
            "type": "array",
            "description": "Typed rows whose stored payload no longer parses — readable history, never enforced.",
            "items": {
              "type": "object",
              "required": [
                "decisionId",
                "key"
              ],
              "additionalProperties": false,
              "properties": {
                "decisionId": {
                  "type": "string"
                },
                "key": {
                  "type": "string"
                }
              }
            }
          },
          "legacyUntypedPolicyCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobOpsPolicyHistoryPage": {
        "type": "object",
        "description": "One bounded page of the append-only typed-policy lineage, oldest revision first per key. Superseded and expired history included.",
        "required": [
          "contextRevision",
          "complete",
          "revisions",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer"
          },
          "complete": {
            "type": "boolean",
            "description": "True only when this single page contains the entire lineage."
          },
          "revisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsTypedPolicyRow"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsPolicyRecordResult": {
        "type": "object",
        "description": "Typed policy record result. WORKFLOW/CANONICAL_DB targets applied their brief/canonical enforcement atomically in the same transaction.",
        "required": [
          "decision",
          "replayed",
          "briefRevision",
          "canonical",
          "contextRevision"
        ],
        "additionalProperties": false,
        "properties": {
          "decision": {
            "$ref": "#/components/schemas/JobOpsTypedPolicyRow"
          },
          "replayed": {
            "type": "boolean"
          },
          "briefRevision": {
            "type": [
              "integer",
              "null"
            ],
            "description": "New brief revision when WORKFLOW enforcement changed the workflow."
          },
          "canonical": {
            "oneOf": [
              {
                "type": "object",
                "description": "Atomic canonical-database application receipt (CANONICAL_DB target).",
                "required": [
                  "itemsSeen",
                  "itemVersionsPublished",
                  "bindingsSeen",
                  "bindingPolicyOverrides",
                  "lessonModeOverrides",
                  "submittedLessonsCompleted",
                  "assignmentsReconciled",
                  "overrideEvidenceRefs"
                ],
                "additionalProperties": false,
                "properties": {
                  "itemsSeen": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "itemVersionsPublished": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "bindingsSeen": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "bindingPolicyOverrides": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "lessonModeOverrides": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "submittedLessonsCompleted": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "assignmentsReconciled": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "overrideEvidenceRefs": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "contextRevision": {
            "type": "integer"
          }
        }
      },
      "JobOpsPolicyEnforcementResult": {
        "type": "object",
        "description": "External enforcement verification result: a SUPERSEDING revision of the same policy carrying the verification evidence with status APPLIED.",
        "required": [
          "decision",
          "replayed",
          "contextRevision"
        ],
        "additionalProperties": false,
        "properties": {
          "decision": {
            "$ref": "#/components/schemas/JobOpsTypedPolicyRow"
          },
          "replayed": {
            "type": "boolean"
          },
          "contextRevision": {
            "type": "integer"
          }
        }
      },
      "JobOpsOperatingGuide": {
        "type": "object",
        "description": "The deterministic, read-only canonical typed projection of the Agent Guide (without the published Playbook): a pure projection of authoritative rows (brief workflow, effective typed policies, exceptions, open claims, fresh attention signals) plus the stable shared agent protocol. Never an authority itself and never editable. The checksum digests the canonical structured input EXCLUDING generatedAt.",
        "required": [
          "schemaVersion",
          "jobId",
          "guideVersion",
          "checksum",
          "generatedAt",
          "lastMaterialChangeAt",
          "objective",
          "workflow",
          "workflowInvalid",
          "policies",
          "prohibitions",
          "exceptions",
          "exceptionsComplete",
          "coordination",
          "attention",
          "workCatalog",
          "externalCoverage",
          "nonWaivableGateKeys",
          "protocol"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "jobId": {
            "type": "string"
          },
          "guideVersion": {
            "type": "integer",
            "description": "The context revision this guide projects (its version pin)."
          },
          "checksum": {
            "type": "string",
            "description": "SHA-256 over the canonical structured input."
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastMaterialChangeAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "objective": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "text",
                  "briefRevision"
                ],
                "additionalProperties": false,
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "briefRevision": {
                    "type": "integer"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "workflow": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "schemaVersion",
                  "gates"
                ],
                "additionalProperties": false,
                "properties": {
                  "schemaVersion": {
                    "type": "integer"
                  },
                  "gates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "gateKey",
                        "label",
                        "required",
                        "blocking",
                        "overrideAllowed",
                        "nonWaivable"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "gateKey": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "blocking": {
                          "type": "boolean"
                        },
                        "overrideAllowed": {
                          "type": "boolean"
                        },
                        "nonWaivable": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "workflowInvalid": {
            "type": "boolean"
          },
          "policies": {
            "type": "object",
            "required": [
              "complete",
              "effective",
              "storedInvalidKeys",
              "legacyUntypedPolicyCount",
              "pendingExternalEnforcementKeys"
            ],
            "additionalProperties": false,
            "properties": {
              "complete": {
                "type": "boolean"
              },
              "effective": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "key",
                    "family",
                    "policyRevision",
                    "schemaVersion",
                    "enforcementTarget",
                    "enforcementStatus",
                    "projection",
                    "decisionId",
                    "supersedesDecisionId",
                    "effectiveAt",
                    "expiresAt",
                    "attribution"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "family": {
                      "type": "string",
                      "enum": [
                        "OPERATING_RULE",
                        "TRAINING_PRODUCTION_GATE",
                        "WORKFLOW_GATE_RULE",
                        "WORK_DEFINITION_APPROVAL",
                        "WORK_DUPLICATE_RESOLUTION",
                        "WORK_COORDINATION_MODE"
                      ]
                    },
                    "policyRevision": {
                      "type": "integer"
                    },
                    "schemaVersion": {
                      "type": "integer"
                    },
                    "enforcementTarget": {
                      "type": "string",
                      "enum": [
                        "GUIDE",
                        "WORKFLOW",
                        "CANONICAL_DB",
                        "EXTERNAL"
                      ]
                    },
                    "enforcementStatus": {
                      "type": "string",
                      "enum": [
                        "APPLIED",
                        "PENDING_ENFORCEMENT",
                        "DRIFTED",
                        "NOT_APPLICABLE"
                      ]
                    },
                    "projection": {
                      "description": "Safe structured guide projection of the payload — typed fields only.",
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "family",
                            "kind",
                            "statement",
                            "rationale"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "family": {
                              "type": "string",
                              "enum": [
                                "OPERATING_RULE"
                              ]
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "REQUIREMENT",
                                "PROHIBITION"
                              ]
                            },
                            "statement": {
                              "type": "string"
                            },
                            "rationale": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        },
                        {
                          "type": "object",
                          "required": [
                            "family",
                            "basis",
                            "gradingReviewRequiredBeforeReadiness"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "family": {
                              "type": "string",
                              "enum": [
                                "TRAINING_PRODUCTION_GATE"
                              ]
                            },
                            "basis": {
                              "type": "string",
                              "enum": [
                                "COURSE_COMPLETION",
                                "SCORED_ASSESSMENTS"
                              ]
                            },
                            "gradingReviewRequiredBeforeReadiness": {
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "required": [
                            "family",
                            "gateKey",
                            "required",
                            "blocking",
                            "overrideAllowed"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "family": {
                              "type": "string",
                              "enum": [
                                "WORKFLOW_GATE_RULE"
                              ]
                            },
                            "gateKey": {
                              "type": "string"
                            },
                            "required": {
                              "type": "boolean"
                            },
                            "blocking": {
                              "type": "boolean"
                            },
                            "overrideAllowed": {
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "required": [
                            "family",
                            "definitionKey",
                            "contentHash",
                            "coordinationSignature"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "family": {
                              "type": "string",
                              "enum": [
                                "WORK_DEFINITION_APPROVAL"
                              ]
                            },
                            "definitionKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                            },
                            "contentHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "coordinationSignature": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "required": [
                            "family",
                            "definitionKey",
                            "candidateDefinitionKey",
                            "outcome",
                            "selectedDefinitionKey"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "family": {
                              "type": "string",
                              "enum": [
                                "WORK_DUPLICATE_RESOLUTION"
                              ]
                            },
                            "definitionKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                            },
                            "candidateDefinitionKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                            },
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "DISTINCT",
                                "DUPLICATE"
                              ]
                            },
                            "selectedDefinitionKey": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "description": "DUPLICATE: the selected existing definition; DISTINCT: null."
                            }
                          }
                        },
                        {
                          "type": "object",
                          "required": [
                            "family",
                            "mode",
                            "rationale"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "family": {
                              "type": "string",
                              "enum": [
                                "WORK_COORDINATION_MODE"
                              ]
                            },
                            "mode": {
                              "type": "string",
                              "enum": [
                                "OPEN",
                                "COORDINATED",
                                "MANAGED"
                              ]
                            },
                            "rationale": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          }
                        }
                      ]
                    },
                    "decisionId": {
                      "type": "string"
                    },
                    "supersedesDecisionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "effectiveAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "attribution": {
                      "type": "object",
                      "required": [
                        "createdByUserId",
                        "createdByAgentText",
                        "approvedByUserId",
                        "approvedAt"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "createdByUserId": {
                          "type": "string"
                        },
                        "createdByAgentText": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "approvedByUserId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "approvedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              },
              "storedInvalidKeys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "legacyUntypedPolicyCount": {
                "type": "integer",
                "minimum": 0
              },
              "pendingExternalEnforcementKeys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "prohibitions": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "key",
                "statement",
                "rationale"
              ],
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string"
                },
                "statement": {
                  "type": "string"
                },
                "rationale": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "exceptions": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "decisionId",
                "title",
                "scopePersonUserId",
                "gateKey",
                "expiresAt"
              ],
              "additionalProperties": false,
              "properties": {
                "decisionId": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "scopePersonUserId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "gateKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expiresAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              }
            }
          },
          "exceptionsComplete": {
            "type": "boolean"
          },
          "coordination": {
            "type": "object",
            "required": [
              "openActions",
              "openActionsComplete"
            ],
            "additionalProperties": false,
            "properties": {
              "openActions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "actionId",
                    "title",
                    "status",
                    "priority",
                    "claimOwner",
                    "claimedByUserId",
                    "claimExpiresAt",
                    "dueAt",
                    "subjectPersonUserId"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "actionId": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "CLAIMED"
                      ]
                    },
                    "priority": {
                      "type": "string",
                      "enum": [
                        "LOW",
                        "NORMAL",
                        "HIGH",
                        "URGENT"
                      ]
                    },
                    "claimOwner": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "claimExpiresAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "dueAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "openActionsComplete": {
                "type": "boolean"
              }
            }
          },
          "attention": {
            "type": "object",
            "required": [
              "top",
              "activeByBand",
              "staleCount",
              "incompleteCount",
              "shadowExcluded",
              "complete"
            ],
            "additionalProperties": false,
            "properties": {
              "top": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "signalId",
                    "ruleKey",
                    "title",
                    "priorityBand",
                    "priorityScore",
                    "freshness",
                    "triage",
                    "occurrenceNumber",
                    "subjectPersonUserId"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "signalId": {
                      "type": "string"
                    },
                    "ruleKey": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "priorityBand": {
                      "type": "string",
                      "enum": [
                        "P0",
                        "P1",
                        "P2",
                        "P3"
                      ]
                    },
                    "priorityScore": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "freshness": {
                      "type": "string",
                      "enum": [
                        "FRESH"
                      ]
                    },
                    "triage": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "ACKNOWLEDGED"
                      ]
                    },
                    "occurrenceNumber": {
                      "type": "integer"
                    },
                    "subjectPersonUserId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "activeByBand": {
                "type": "object",
                "required": [
                  "P0",
                  "P1",
                  "P2",
                  "P3"
                ],
                "additionalProperties": false,
                "properties": {
                  "P0": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "P1": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "P2": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "P3": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              },
              "staleCount": {
                "type": "integer",
                "minimum": 0
              },
              "incompleteCount": {
                "type": "integer",
                "minimum": 0
              },
              "shadowExcluded": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "complete": {
                "type": "boolean"
              }
            }
          },
          "workCatalog": {
            "$ref": "#/components/schemas/JobOpsWorkCatalogSummary"
          },
          "externalCoverage": {
            "$ref": "#/components/schemas/JobOpsExternalCoverage"
          },
          "nonWaivableGateKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "protocol": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JobOpsWorkCatalogSummary": {
        "type": "object",
        "description": "This job's Work Catalog: defined work, live provisional inventory, a neutral setup state, and the winner-only setup lease. Work semantics are per-job catalog data — the platform ships coordination mechanics only.",
        "required": [
          "setupState",
          "activeDefinitionCount",
          "provisionalOpenCount",
          "definitions",
          "provisional",
          "definitionsComplete",
          "provisionalComplete",
          "openExecutionsComplete",
          "approvalPendingCount",
          "setupIntent",
          "coordination"
        ],
        "additionalProperties": false,
        "properties": {
          "setupState": {
            "type": "string",
            "enum": [
              "UNCONFIGURED",
              "PROVISIONAL_ONLY",
              "CONFIGURED"
            ]
          },
          "activeDefinitionCount": {
            "type": "integer",
            "minimum": 0
          },
          "provisionalOpenCount": {
            "type": "integer",
            "minimum": 0
          },
          "definitions": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "definitionId",
                "definitionKey",
                "status",
                "currentVersionNumber",
                "contentHash",
                "coordinationSignature",
                "migrationFrozen",
                "openExecutionCount",
                "latestVersionId",
                "latestVersionNumber",
                "latestAuthority",
                "approvalPending",
                "duplicateCandidateCount",
                "duplicateCandidatesComplete",
                "entryValid"
              ],
              "additionalProperties": false,
              "properties": {
                "definitionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "definitionKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "DRAFT",
                    "ACTIVE",
                    "ARCHIVED",
                    null
                  ]
                },
                "currentVersionNumber": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1
                },
                "contentHash": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "coordinationSignature": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "migrationFrozen": {
                  "type": "boolean"
                },
                "openExecutionCount": {
                  "type": "integer",
                  "minimum": 0
                },
                "latestVersionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latestVersionNumber": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1
                },
                "latestAuthority": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "INFERRED",
                    "DECIDED",
                    null
                  ]
                },
                "approvalPending": {
                  "type": "boolean",
                  "description": "C-DEV3191-066: the latest lineage head is an INFERRED proposal awaiting human approval (cannot activate)."
                },
                "duplicateCandidateCount": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 0,
                  "description": "RC10 (C-DEV3191-079): for a pending proposal, the number of UNRESOLVED possible-duplicate candidates the bounded matcher found; null when no scan applies."
                },
                "duplicateCandidatesComplete": {
                  "type": [
                    "boolean",
                    "null"
                  ],
                  "description": "False when the candidate scan truncated or skipped unreadable definitions; null when no scan applies."
                },
                "entryValid": {
                  "type": "boolean"
                }
              }
            }
          },
          "provisional": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "object",
              "required": [
                "executionId",
                "label",
                "serverKey",
                "expiresAt",
                "expired",
                "claimedByUserId",
                "claimOwner",
                "entryValid"
              ],
              "additionalProperties": false,
              "properties": {
                "executionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "label": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "serverKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expiresAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "expired": {
                  "type": "boolean"
                },
                "claimedByUserId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "claimOwner": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "entryValid": {
                  "type": "boolean"
                }
              }
            }
          },
          "definitionsComplete": {
            "type": "boolean"
          },
          "provisionalComplete": {
            "type": "boolean"
          },
          "openExecutionsComplete": {
            "type": "boolean"
          },
          "approvalPendingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "C-DEV3191-066: EXACT count of non-archived definitions whose latest version is an INFERRED proposal awaiting human approval (aggregate query, never the capped page)."
          },
          "setupIntent": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "intentId",
              "principalUserId",
              "agentLabel",
              "sessionId",
              "expiresAt"
            ],
            "additionalProperties": false,
            "properties": {
              "intentId": {
                "type": "string"
              },
              "principalUserId": {
                "type": "string"
              },
              "agentLabel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sessionId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "C-DEV3191-067: the exact durable session owning the lease (null for ephemeral/legacy declarations). A caller owns setup only when this equals its own non-null sync.session.sessionId AND the principal matches."
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "coordination": {
            "type": "object",
            "description": "DEV-3191 Phase 5 (RC9): the job's effective work-coordination mode, projected from the CURRENT effective unsuperseded heads of the singleton WORK_COORDINATION_MODE policy in the same snapshot. `mode` is null (complete=false) when rows exist but no current head does, the lineage is branched, or the head is unreadable — fail-closed evidence for guarded mutations, never OPEN. Total absence of rows is the only implicit OPEN.",
            "required": [
              "mode",
              "decisionId",
              "complete"
            ],
            "additionalProperties": false,
            "properties": {
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "OPEN",
                  "COORDINATED",
                  "MANAGED",
                  null
                ]
              },
              "decisionId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "complete": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "JobOpsExternalAttestation": {
        "description": "DEV-3191 Phase 5 (RC9): the closed external attestation/invalidation an OBSERVED observation may carry under metadata.externalAttestation. ATTEST records what was observed about an external system (bounded per-job source system slug, optional locator and subject, claim, non-future attestedAt, REQUIRED expiry ≤ 30 days) and may supersede an earlier ATTEST with the same coverage identity; INVALIDATE retires one ATTEST (webhook/UI/agent/human). The server proves the same-context lineage before writing. Attribution is canonical (createdByUserId + normalized actorAgentLabel), never nested.",
        "oneOf": [
          {
            "type": "object",
            "required": [
              "schemaVersion",
              "kind",
              "source",
              "subject",
              "claim",
              "attestedAt",
              "expiresAt",
              "supersedesObservationId"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ATTEST"
                ]
              },
              "source": {
                "type": "object",
                "required": [
                  "system",
                  "locator"
                ],
                "additionalProperties": false,
                "properties": {
                  "system": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
                  },
                  "locator": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 500
                  }
                }
              },
              "subject": {
                "type": [
                  "object",
                  "null"
                ],
                "required": [
                  "kind",
                  "entityId"
                ],
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "contract",
                      "proposal",
                      "person",
                      "job",
                      "ops_action",
                      "ops_observation",
                      "ops_decision",
                      "ops_work_execution",
                      "external"
                    ]
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                }
              },
              "claim": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "attestedAt": {
                "type": "string",
                "format": "date-time"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "supersedesObservationId": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "maxLength": 200
              }
            }
          },
          {
            "type": "object",
            "required": [
              "schemaVersion",
              "kind",
              "invalidatesObservationId",
              "invalidationSource",
              "reason",
              "invalidatedAt"
            ],
            "additionalProperties": false,
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "INVALIDATE"
                ]
              },
              "invalidatesObservationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "invalidationSource": {
                "type": "string",
                "enum": [
                  "WEBHOOK",
                  "UI",
                  "AGENT",
                  "HUMAN"
                ]
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "invalidatedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "JobOpsWorkCoordinationConflictDetails": {
        "type": "object",
        "description": "C-DEV3191-104: the CLOSED 409 `details` a guarded mutation (the managed message send today; every guard-bearing domain mutation) returns when the job's work-coordination mode refuses it. `requirement` names the recovery — WORK_EXECUTION_REQUIRED (COORDINATED/MANAGED: begin defined or provisional work and claim the coordinating action it mints), DEFINED_WORK_REQUIRED (MANAGED: the bound execution is provisional or its definition is not ACTIVE — promote/approve or begin defined work), MODE_UNREADABLE (the WORK_COORDINATION_MODE lineage has no current head, is branched, or its head is unreadable; a human records one readable revision). `mode` is the effective mode, null when unreadable. Ordinary conflicts (STALE_REVISION, action state, idempotency) are unchanged.",
        "required": [
          "reason",
          "requirement",
          "mode"
        ],
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "JOB_OPS_WORK_COORDINATION_REQUIRED"
            ]
          },
          "requirement": {
            "type": "string",
            "enum": [
              "WORK_EXECUTION_REQUIRED",
              "DEFINED_WORK_REQUIRED",
              "MODE_UNREADABLE"
            ]
          },
          "mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "OPEN",
              "COORDINATED",
              "MANAGED",
              null
            ]
          }
        }
      },
      "JobOpsExternalCoverage": {
        "type": "object",
        "description": "DEV-3191 Phase 5 (RC9): the guide's external-coverage packet — what is CURRENTLY attested about external systems this job touches, with lineage/expiry/invalidation honesty. Every system or subject without a CURRENT attestation is UNKNOWN (defaultStatus). Entries read UNKNOWN (with a closed problem) when the stored row is poisoned, future-dated, wrongly authored, orphaned, branched, or identity-mismatched; counts cover the scanned rows and `complete` says whether the bounded scan held every attestation row.",
        "required": [
          "defaultStatus",
          "entries",
          "attestedCount",
          "expiredCount",
          "invalidatedCount",
          "supersededCount",
          "unknownCount",
          "complete"
        ],
        "additionalProperties": false,
        "properties": {
          "defaultStatus": {
            "type": "string",
            "enum": [
              "UNKNOWN"
            ]
          },
          "entries": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "observationId",
                "status",
                "problem",
                "kind",
                "system",
                "locator",
                "subject",
                "claim",
                "attestedAt",
                "expiresAt",
                "endedBy",
                "recordedByUserId",
                "recordedByAgentLabel",
                "recordedAt",
                "evidenceRefs",
                "entryValid"
              ],
              "additionalProperties": false,
              "properties": {
                "observationId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ATTESTED",
                    "EXPIRED",
                    "INVALIDATED",
                    "SUPERSEDED",
                    "UNKNOWN"
                  ]
                },
                "problem": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "POISONED",
                    "WRONG_AUTHORITY",
                    "FUTURE_DATED",
                    "ORPHAN_LINEAGE",
                    "BRANCHED_LINEAGE",
                    "IDENTITY_MISMATCH",
                    null
                  ],
                  "description": "Non-null exactly when status is UNKNOWN."
                },
                "kind": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "ATTEST",
                    "INVALIDATE",
                    null
                  ]
                },
                "system": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "locator": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "subject": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "required": [
                    "kind",
                    "entityId"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "contract",
                        "proposal",
                        "person",
                        "job",
                        "ops_action",
                        "ops_observation",
                        "ops_decision",
                        "ops_work_execution",
                        "external"
                      ]
                    },
                    "entityId": {
                      "type": "string"
                    }
                  }
                },
                "claim": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "attestedAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "expiresAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "endedBy": {
                  "description": "C-DEV3191-108: the closed ending receipt — present exactly when status is INVALIDATED (kind INVALIDATE) or SUPERSEDED (kind ATTEST, the successor): who ended it, why, when, and with what evidence.",
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "observationId",
                        "kind",
                        "invalidationSource",
                        "reason",
                        "endedAt",
                        "recordedByUserId",
                        "recordedByAgentLabel",
                        "recordedAt",
                        "evidenceRefs"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "observationId": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "ATTEST",
                            "INVALIDATE"
                          ]
                        },
                        "invalidationSource": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "WEBHOOK",
                            "UI",
                            "AGENT",
                            "HUMAN",
                            null
                          ]
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "endedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "recordedByUserId": {
                          "type": "string"
                        },
                        "recordedByAgentLabel": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "recordedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "evidenceRefs": {
                          "type": "array",
                          "maxItems": 10,
                          "items": {
                            "$ref": "#/components/schemas/JobOpsEvidenceRef"
                          }
                        }
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "recordedByUserId": {
                  "type": "string"
                },
                "recordedByAgentLabel": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recordedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "evidenceRefs": {
                  "type": "array",
                  "maxItems": 10,
                  "items": {
                    "$ref": "#/components/schemas/JobOpsEvidenceRef"
                  }
                },
                "entryValid": {
                  "type": "boolean"
                }
              }
            }
          },
          "attestedCount": {
            "type": "integer",
            "minimum": 0
          },
          "expiredCount": {
            "type": "integer",
            "minimum": 0
          },
          "invalidatedCount": {
            "type": "integer",
            "minimum": 0
          },
          "supersededCount": {
            "type": "integer",
            "minimum": 0
          },
          "unknownCount": {
            "type": "integer",
            "minimum": 0
          },
          "complete": {
            "type": "boolean"
          }
        }
      },
      "JobOpsOperatingGuideResponse": {
        "type": "object",
        "description": "The canonical typed projection of the Agent Guide as structured JSON plus its deterministic Markdown rendering. Both are pure projections of the same fenced read.",
        "required": [
          "guide",
          "markdown"
        ],
        "additionalProperties": false,
        "properties": {
          "guide": {
            "$ref": "#/components/schemas/JobOpsOperatingGuide"
          },
          "markdown": {
            "type": "string"
          }
        }
      },
      "JobOpsSetupComponentState": {
        "type": "object",
        "description": "One guided-setup component with its deterministic status, canonical evidence, and (when satisfied or deferred) full attribution.",
        "required": [
          "component",
          "status",
          "evidenceRefs",
          "satisfiedBy",
          "deferral",
          "invalidReason"
        ],
        "additionalProperties": false,
        "properties": {
          "component": {
            "type": "string",
            "enum": [
              "OBJECTIVE_BRIEF",
              "TYPED_WORKFLOW",
              "TRAINING_PRODUCTION_GATE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "SATISFIED",
              "MISSING",
              "INVALID",
              "NOT_APPLICABLE",
              "DEFERRED",
              "INDETERMINATE"
            ]
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "satisfiedBy": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "briefRevision",
                  "policyDecisionId",
                  "recordedByUserId",
                  "recordedByAgentLabel",
                  "recordedAt"
                ],
                "additionalProperties": false,
                "properties": {
                  "briefRevision": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "policyDecisionId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "recordedByUserId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "recordedByAgentLabel": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "recordedAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "deferral": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "policyDecisionId",
                  "policyKey",
                  "recordedByUserId",
                  "recordedAt",
                  "expiresAt"
                ],
                "additionalProperties": false,
                "properties": {
                  "policyDecisionId": {
                    "type": "string"
                  },
                  "policyKey": {
                    "type": "string"
                  },
                  "recordedByUserId": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "expiresAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "invalidReason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsSetupProjection": {
        "type": "object",
        "description": "The deterministic shared guided-setup projection: which operational setup this job still needs, derived only from the latest brief, effective typed policies, and canonical job facts. Completion is shared — the state converges for every agent, and clients must not re-prompt once it reports COMPLETE or DEFERRED.",
        "required": [
          "schemaVersion",
          "status",
          "components",
          "advisories",
          "evidenceComplete"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "COMPLETE",
              "INCOMPLETE",
              "DEFERRED",
              "INDETERMINATE"
            ]
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsSetupComponentState"
            }
          },
          "advisories": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code",
                "evidenceRefs"
              ],
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "WORKFLOW_WITHOUT_REQUIRED_GATES",
                    "TRAINING_GATE_SOURCE_UNRESOLVED",
                    "POLICY_EVIDENCE_TRUNCATED"
                  ]
                },
                "evidenceRefs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/JobOpsEvidenceRef"
                  }
                }
              }
            }
          },
          "evidenceComplete": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSetupQuestion": {
        "type": "object",
        "description": "One ordered deterministic setup question. Proposed values are recommendations with provenance — present them to the responsible human; never apply one silently.",
        "required": [
          "questionKey",
          "component",
          "prompt",
          "kind",
          "choices",
          "required",
          "proposedValue"
        ],
        "additionalProperties": false,
        "properties": {
          "questionKey": {
            "type": "string",
            "enum": [
              "objective.statement",
              "workflow.definition",
              "workflow.training_course",
              "workflow.assessment",
              "policy.training_production_gate.basis"
            ]
          },
          "component": {
            "type": "string",
            "enum": [
              "OBJECTIVE_BRIEF",
              "TYPED_WORKFLOW",
              "TRAINING_PRODUCTION_GATE"
            ]
          },
          "prompt": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "FREE_TEXT",
              "SINGLE_CHOICE"
            ]
          },
          "choices": {
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "value",
                    "label",
                    "evidenceRefs"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "value": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "evidenceRefs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/JobOpsEvidenceRef"
                      }
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "required": {
            "type": "boolean"
          },
          "proposedValue": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "value",
                  "authority",
                  "derivedFromEvidenceRefs"
                ],
                "additionalProperties": false,
                "properties": {
                  "value": {
                    "type": "string"
                  },
                  "authority": {
                    "type": "string",
                    "enum": [
                      "RECOMMENDED"
                    ]
                  },
                  "derivedFromEvidenceRefs": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsSetupProposedWrite": {
        "type": "object",
        "description": "Zero-surprise canonical write preview: the exact operation, path, and validated request-body draft an approving human should see. Nothing here executes automatically; the named operation still requires jobs:write, the current expectedContextRevision, and an idempotency key.",
        "required": [
          "operationId",
          "method",
          "pathTemplate",
          "bodyTemplate",
          "answersNeeded",
          "requires",
          "executionGuard"
        ],
        "additionalProperties": false,
        "properties": {
          "operationId": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "POST"
            ]
          },
          "pathTemplate": {
            "type": "string"
          },
          "bodyTemplate": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "objective",
                  "workflowDefinition"
                ],
                "additionalProperties": false,
                "properties": {
                  "objective": {
                    "type": "string"
                  },
                  "workflowDefinition": {
                    "$ref": "#/components/schemas/JobOpsWorkflowDefinition"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "answersNeeded": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "objective.statement",
                "workflow.definition",
                "workflow.training_course",
                "workflow.assessment",
                "policy.training_production_gate.basis"
              ]
            }
          },
          "requires": {
            "type": "object",
            "required": [
              "expectedContextRevision",
              "idempotencyKey",
              "scope"
            ],
            "additionalProperties": false,
            "properties": {
              "expectedContextRevision": {
                "type": "boolean"
              },
              "idempotencyKey": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "scope": {
                "type": "string",
                "enum": [
                  "jobs:write"
                ]
              }
            }
          },
          "executionGuard": {
            "type": "string",
            "enum": [
              "AUTO_REVERSIBLE",
              "EXPLICIT_APPROVAL",
              "HUMAN_COSIGN",
              "OWNER_GATED",
              "PROHIBITED"
            ]
          }
        }
      },
      "JobOpsSetupPacket": {
        "type": "object",
        "description": "The machine-readable guided-setup packet: deterministic shared setup state, ordered questions with evidence-backed proposed defaults, validated canonical write previews, authority/approval requirements, whether work may continue, and the bounded in-progress dedupe view (active setup.* intents and open setup.* proposals).",
        "required": [
          "schemaVersion",
          "jobId",
          "contextExists",
          "contextRevision",
          "setup",
          "questions",
          "proposedWrites",
          "approval",
          "workMayContinue",
          "evidenceRecovery",
          "inProgress",
          "workCatalog",
          "sharedCompletion"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "jobId": {
            "type": "string"
          },
          "contextExists": {
            "type": "boolean"
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "setup": {
            "$ref": "#/components/schemas/JobOpsSetupProjection"
          },
          "questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsSetupQuestion"
            }
          },
          "proposedWrites": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsSetupProposedWrite"
            }
          },
          "approval": {
            "type": "object",
            "required": [
              "executionGuard",
              "humanApprovalRequired",
              "deferralPolicyKeys",
              "statement"
            ],
            "additionalProperties": false,
            "properties": {
              "executionGuard": {
                "type": "string",
                "enum": [
                  "EXPLICIT_APPROVAL"
                ]
              },
              "humanApprovalRequired": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "deferralPolicyKeys": {
                "type": "object",
                "required": [
                  "OBJECTIVE_BRIEF",
                  "TYPED_WORKFLOW",
                  "TRAINING_PRODUCTION_GATE"
                ],
                "additionalProperties": false,
                "properties": {
                  "OBJECTIVE_BRIEF": {
                    "type": "string"
                  },
                  "TYPED_WORKFLOW": {
                    "type": "string"
                  },
                  "TRAINING_PRODUCTION_GATE": {
                    "type": "string"
                  }
                }
              },
              "statement": {
                "type": "string"
              }
            }
          },
          "workMayContinue": {
            "type": "object",
            "required": [
              "allowed",
              "reason"
            ],
            "additionalProperties": false,
            "properties": {
              "allowed": {
                "type": "boolean"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "evidenceRecovery": {
            "description": "Non-null exactly when setup.status is INDETERMINATE: the safe read/retry path out of the fail-closed evidence state. Names a READ operation only — the platform never invents missing decisions.",
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "operationId",
                  "reason"
                ],
                "additionalProperties": false,
                "properties": {
                  "operationId": {
                    "type": "string",
                    "enum": [
                      "job_operations.policies.list"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "inProgress": {
            "type": "object",
            "required": [
              "intents",
              "proposals",
              "complete"
            ],
            "additionalProperties": false,
            "properties": {
              "intents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "intentId",
                    "intentKey",
                    "title",
                    "principalUserId",
                    "agentLabel",
                    "sessionId",
                    "expiresAt"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "intentId": {
                      "type": "string"
                    },
                    "intentKey": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "principalUserId": {
                      "type": "string"
                    },
                    "agentLabel": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sessionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The durable sync session that declared this intent (null for legacy/ephemeral declarations). Adopting an intent requires the caller's current durable session to equal this value exactly."
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "proposals": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "proposalId",
                    "dedupeKey",
                    "title",
                    "proposedByUserId",
                    "createdAt"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "dedupeKey": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "proposedByUserId": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "complete": {
                "type": "boolean"
              }
            }
          },
          "workCatalog": {
            "$ref": "#/components/schemas/JobOpsWorkCatalogSummary"
          },
          "sharedCompletion": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "JobOpsSyncCoverageDiagnostic": {
        "type": "object",
        "description": "Closed automatic-sync coverage diagnostic: why this response does (or honestly does not) carry a `sync` envelope. Safe for narrow tokens — it contains no project state.",
        "required": [
          "operationId",
          "coverage",
          "attached",
          "reason",
          "requiredReadScope"
        ],
        "additionalProperties": false,
        "properties": {
          "operationId": {
            "type": "string"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "native",
              "bridged",
              "conditional",
              "none"
            ]
          },
          "attached": {
            "type": "boolean"
          },
          "reason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "NOT_JOB_SCOPED",
                  "BRIDGE_PENDING",
                  "MISSING_JOBS_READ_SCOPE",
                  "SESSION_UNAVAILABLE",
                  "SYNC_NOT_REQUESTED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "requiredReadScope": {
            "type": "string",
            "enum": [
              "jobs:read"
            ]
          }
        }
      },
      "JobOpsSyncSessionInfo": {
        "type": "object",
        "description": "Server-resolved session identity. `mintedCredential` appears exactly once — on the response that minted a durable session — and must be persisted by the client; a caller can never name a session id.",
        "required": [
          "mode",
          "sessionId",
          "surface",
          "principalUserId",
          "agentLabel",
          "mintedCredential",
          "credentialProblem"
        ],
        "additionalProperties": false,
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "DURABLE",
              "EPHEMERAL"
            ]
          },
          "sessionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "surface": {
            "type": "string",
            "enum": [
              "REST",
              "SDK",
              "CLI",
              "MCP_STDIO",
              "MCP_HOSTED"
            ]
          },
          "principalUserId": {
            "type": "string"
          },
          "agentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "mintedCredential": {
            "type": [
              "string",
              "null"
            ]
          },
          "credentialProblem": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "MALFORMED",
                  "UNKNOWN",
                  "KEY_ROTATED",
                  "PRINCIPAL_MISMATCH",
                  "ORGANIZATION_MISMATCH",
                  "SURFACE_MISMATCH",
                  "REVOKED"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsSyncChangeEntry": {
        "type": "object",
        "description": "One bounded delta entry mirroring the closed public event allowlist. Actor identity fields are intentionally absent.",
        "required": [
          "eventId",
          "contextRevision",
          "eventType",
          "sourceDomain",
          "subjectPersonUserId",
          "recordedAt",
          "evidenceRefs"
        ],
        "additionalProperties": false,
        "properties": {
          "eventId": {
            "type": "string"
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 1
          },
          "eventType": {
            "type": "string"
          },
          "sourceDomain": {
            "type": "string"
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time"
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          }
        }
      },
      "JobOpsSyncConflict": {
        "type": "object",
        "description": "A typed, deterministically evidenced conflict. The platform detects; the agent explains — no server-side semantic inference.",
        "required": [
          "code",
          "message",
          "expectedRevision",
          "currentRevision",
          "subjectId",
          "competingOwner",
          "reconciliation"
        ],
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "REVISION_STALE",
              "CLAIM_HELD",
              "DUPLICATE_INTENT",
              "POLICY_CONTRADICTION",
              "WORKFLOW_GATE_BLOCK",
              "GOAL_CONFLICT",
              "SOURCE_INCOMPLETE",
              "OVERLAY_SUPERSEDED",
              "AUTHORITY_REQUIRED",
              "CANONICAL_STATE_CHANGED",
              "WORK_DEFINITION_STALE",
              "WORK_MIGRATION_IN_PROGRESS",
              "WORK_COORDINATION_CONFLICT"
            ]
          },
          "message": {
            "type": "string"
          },
          "expectedRevision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "currentRevision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "subjectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "competingOwner": {
            "type": [
              "string",
              "null"
            ]
          },
          "reconciliation": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "REFRESH_AND_RETRY",
                "CLAIM_FIRST",
                "DECLARE_INTENT",
                "ADOPT_EXISTING",
                "ESCALATE_PROPOSAL"
              ]
            }
          }
        }
      },
      "JobOpsSyncRecommendation": {
        "type": "object",
        "description": "Deterministic capability recommendation derived from typed attention signals. Advisory only — never auto-executed.",
        "required": [
          "ruleKey",
          "capabilityOperationIds",
          "reason",
          "executionGuard",
          "evidenceRefs"
        ],
        "additionalProperties": false,
        "properties": {
          "ruleKey": {
            "type": "string"
          },
          "capabilityOperationIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          },
          "executionGuard": {
            "type": "string",
            "enum": [
              "AUTO_REVERSIBLE",
              "EXPLICIT_APPROVAL",
              "HUMAN_COSIGN",
              "OWNER_GATED",
              "PROHIBITED"
            ]
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          }
        }
      },
      "JobOpsSyncActiveClaimEntry": {
        "type": "object",
        "description": "Strictly parsed active claim projection; a poisoned stored field reads as null with entryValid=false.",
        "required": [
          "actionId",
          "title",
          "priority",
          "claimOwner",
          "claimedByUserId",
          "claimExpiresAt",
          "dueAt",
          "subjectPersonUserId",
          "sourceSignalId",
          "workExecutionId",
          "entryValid"
        ],
        "additionalProperties": false,
        "properties": {
          "actionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "priority": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "LOW",
                  "NORMAL",
                  "HIGH",
                  "URGENT"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "claimOwner": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimExpiresAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceSignalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "workExecutionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryValid": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSyncActiveIntentEntry": {
        "type": "object",
        "description": "Strictly parsed active write-ahead intent projection; a poisoned stored field reads as null with entryValid=false.",
        "required": [
          "intentId",
          "kind",
          "intentKey",
          "title",
          "declaredAtRevision",
          "expiresAt",
          "principalUserId",
          "agentLabel",
          "sessionId",
          "capabilityOperationId",
          "entryValid"
        ],
        "additionalProperties": false,
        "properties": {
          "intentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "MESSAGE_SEND",
                  "POLICY_RECORD",
                  "WORKFLOW_CHANGE",
                  "ACTION_WORK",
                  "CAPABILITY_EXECUTION",
                  "OTHER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "intentKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "declaredAtRevision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "principalUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "agentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "sessionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "capabilityOperationId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryValid": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSyncProposalEntry": {
        "type": "object",
        "description": "Strictly parsed open proposal projection; a poisoned or non-deterministic stored row reads as null with entryValid=false.",
        "required": [
          "proposalId",
          "kind",
          "dedupeKey",
          "title",
          "executionGuard",
          "priorityScore",
          "priorityBand",
          "declaredAtRevision",
          "proposedByUserId",
          "proposedByAgentLabel",
          "createdAt",
          "entryValid"
        ],
        "additionalProperties": false,
        "properties": {
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "POLICY",
                  "WORKFLOW",
                  "PRIORITY",
                  "GOAL",
                  "EXCEPTION",
                  "CAPABILITY_EXECUTION"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "dedupeKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "executionGuard": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "AUTO_REVERSIBLE",
                  "EXPLICIT_APPROVAL",
                  "HUMAN_COSIGN",
                  "OWNER_GATED",
                  "PROHIBITED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "priorityScore": {
            "type": [
              "integer",
              "null"
            ]
          },
          "priorityBand": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "P0",
                  "P1",
                  "P2",
                  "P3"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "declaredAtRevision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "proposedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposedByAgentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryValid": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSyncSourceHealth": {
        "type": "object",
        "description": "Fail-closed completeness signals for every bounded envelope block plus the rollout enforcement mode.",
        "required": [
          "enforcementMode",
          "evaluator",
          "changesComplete",
          "claimsComplete",
          "claimHandoffsComplete",
          "intentsComplete",
          "proposalsComplete",
          "degradedReasons"
        ],
        "additionalProperties": false,
        "properties": {
          "enforcementMode": {
            "type": "string",
            "enum": [
              "observe",
              "warn",
              "enforce"
            ]
          },
          "evaluator": {
            "type": "object",
            "required": [
              "healthy",
              "stale",
              "incomplete"
            ],
            "additionalProperties": false,
            "properties": {
              "healthy": {
                "type": "integer",
                "minimum": 0
              },
              "stale": {
                "type": "integer",
                "minimum": 0
              },
              "incomplete": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "changesComplete": {
            "type": "boolean"
          },
          "claimsComplete": {
            "type": "boolean"
          },
          "claimHandoffsComplete": {
            "type": "boolean"
          },
          "intentsComplete": {
            "type": "boolean"
          },
          "proposalsComplete": {
            "type": "boolean"
          },
          "degradedReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JobOpsWorkVersionApproval": {
        "type": "object",
        "description": "C-DEV3191-060: durable approval provenance of a DECIDED version — the exact human WORK_DEFINITION_APPROVAL decision (normalized link), the approving human, the approval instant, and the decision’s effective instant. Never the policy payload. Null for INFERRED versions and for any DECIDED row whose link cannot be verified.",
        "required": [
          "decisionId",
          "approvedByUserId",
          "approvedAt",
          "effectiveAt"
        ],
        "additionalProperties": false,
        "properties": {
          "decisionId": {
            "type": "string"
          },
          "approvedByUserId": {
            "type": "string"
          },
          "approvedAt": {
            "type": "string",
            "format": "date-time"
          },
          "effectiveAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobOpsWorkVersionSummary": {
        "type": "object",
        "description": "Closed summary of one IMMUTABLE definition version, including the full semantic binding trio (versionNumber + contentHash + coordinationSignature) that definition-bound mutations must present.",
        "required": [
          "versionId",
          "versionNumber",
          "label",
          "authority",
          "leaseTtlSeconds",
          "leaseHeartbeatSeconds",
          "broadExclusiveScope",
          "keyComputationVersion",
          "contentHash",
          "coordinationSignature",
          "createdAt",
          "approval"
        ],
        "additionalProperties": false,
        "properties": {
          "versionId": {
            "type": "string"
          },
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "pattern": "\\S"
          },
          "authority": {
            "type": "string",
            "enum": [
              "INFERRED",
              "DECIDED"
            ]
          },
          "leaseTtlSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 14400
          },
          "leaseHeartbeatSeconds": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 30,
                "maximum": 14399
              },
              {
                "type": "null"
              }
            ]
          },
          "broadExclusiveScope": {
            "type": "boolean"
          },
          "keyComputationVersion": {
            "type": "integer",
            "minimum": 1
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "coordinationSignature": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "approval": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkVersionApproval"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsWorkVersionDetail": {
        "type": "object",
        "description": "One immutable version with its full parsed coordination grammar — everything needed to compose valid targets. Work semantics (role keys, labels, phases) are per-job data, never platform enums.",
        "required": [
          "versionId",
          "versionNumber",
          "label",
          "authority",
          "leaseTtlSeconds",
          "leaseHeartbeatSeconds",
          "broadExclusiveScope",
          "keyComputationVersion",
          "contentHash",
          "coordinationSignature",
          "createdAt",
          "approval",
          "description",
          "targetGrammar",
          "identityRoleKeys",
          "exclusiveScopes",
          "relatedScopes",
          "phases",
          "normalization"
        ],
        "additionalProperties": false,
        "properties": {
          "versionId": {
            "type": "string"
          },
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "pattern": "\\S"
          },
          "authority": {
            "type": "string",
            "enum": [
              "INFERRED",
              "DECIDED"
            ]
          },
          "leaseTtlSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 14400
          },
          "leaseHeartbeatSeconds": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 30,
                "maximum": 14399
              },
              {
                "type": "null"
              }
            ]
          },
          "broadExclusiveScope": {
            "type": "boolean"
          },
          "keyComputationVersion": {
            "type": "integer",
            "minimum": 1
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "coordinationSignature": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "approval": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkVersionApproval"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 10000,
            "description": "Bounded human description of the atomic work (C-DEV3191-062)."
          },
          "targetGrammar": {
            "type": "array",
            "minItems": 1,
            "maxItems": 12,
            "uniqueItems": true,
            "description": "Canonical invariants (server-enforced, cross-field): role keys are unique and at least ONE role is required; identityRoleKeys and every ROLE exclusive scope name required grammar roles; every ROLE related scope names a grammar role.",
            "items": {
              "type": "object",
              "required": [
                "roleKey",
                "kind",
                "required"
              ],
              "additionalProperties": false,
              "properties": {
                "roleKey": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,59}$"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "contract",
                    "proposal",
                    "person",
                    "job",
                    "ops_action",
                    "ops_observation",
                    "ops_decision",
                    "ops_work_execution"
                  ],
                  "description": "CLOSED platform target kind (entity vocabulary, never a work type)."
                },
                "required": {
                  "type": "boolean"
                }
              }
            }
          },
          "identityRoleKeys": {
            "type": "array",
            "minItems": 1,
            "maxItems": 12,
            "uniqueItems": true,
            "description": "Unique role keys that compose the canonical identity — each MUST be a REQUIRED role of targetGrammar (server-enforced cross-field invariant).",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,59}$"
            }
          },
          "exclusiveScopes": {
            "type": "array",
            "maxItems": 12,
            "uniqueItems": true,
            "description": "Unique scope templates: a ROLE scope names a grammar role (an EXCLUSIVE ROLE scope must name a REQUIRED role — server-enforced cross-field invariant); a JOB scope carries no role key.",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "scope",
                    "roleKey"
                  ],
                  "properties": {
                    "scope": {
                      "type": "string",
                      "enum": [
                        "ROLE"
                      ]
                    },
                    "roleKey": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    }
                  }
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "scope"
                  ],
                  "properties": {
                    "scope": {
                      "type": "string",
                      "enum": [
                        "JOB"
                      ]
                    }
                  }
                }
              ]
            }
          },
          "relatedScopes": {
            "type": "array",
            "maxItems": 12,
            "uniqueItems": true,
            "description": "Descriptive, non-enforcing related scopes (C-DEV3191-062).",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "scope",
                    "roleKey"
                  ],
                  "properties": {
                    "scope": {
                      "type": "string",
                      "enum": [
                        "ROLE"
                      ]
                    },
                    "roleKey": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    }
                  }
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "scope"
                  ],
                  "properties": {
                    "scope": {
                      "type": "string",
                      "enum": [
                        "JOB"
                      ]
                    }
                  }
                }
              ]
            }
          },
          "phases": {
            "type": "array",
            "maxItems": 20,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          "normalization": {
            "description": "The exact public normalization contract behind this version’s server keys: identity refs (roleKey, kind, entityId) sorted by role key, lineage = the definition key, canonical JSON, SHA-256. Null only when the stored spec fails the closed contract.",
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "keyComputationVersion",
                  "lineage"
                ],
                "additionalProperties": false,
                "properties": {
                  "keyComputationVersion": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "lineage": {
                    "type": "string",
                    "enum": [
                      "definition-key"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsWorkBinding": {
        "type": "object",
        "description": "The exact immutable binding of one definition version: version number + content hash + coordination signature (C-DEV3191-044/058).",
        "required": [
          "versionNumber",
          "contentHash",
          "coordinationSignature"
        ],
        "additionalProperties": false,
        "properties": {
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "coordinationSignature": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "JobOpsWorkDuplicateCandidate": {
        "type": "object",
        "description": "RC10 (C-DEV3191-079): one ATTRIBUTED possible duplicate of a definition — related by normalized label similarity and/or the role-label-independent shape of the validated grammar. Never semantic equivalence; a human records the durable resolution (WORK_DUPLICATE_RESOLUTION) bound to both exact bindings.",
        "required": [
          "definitionKey",
          "definitionStatus",
          "latestVersionNumber",
          "latestAuthority",
          "contentHash",
          "coordinationSignature",
          "label",
          "relation",
          "labelSimilarity",
          "shapeMatch",
          "differences",
          "semantics",
          "resolution"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
          },
          "definitionStatus": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "latestVersionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "latestAuthority": {
            "type": "string",
            "enum": [
              "INFERRED",
              "DECIDED"
            ]
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "coordinationSignature": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "relation": {
            "type": "string",
            "enum": [
              "SIMILAR_LABEL_SAME_SHAPE",
              "SAME_SHAPE_DISSIMILAR_LABEL",
              "SIMILAR_LABEL_DIFFERENT_SHAPE",
              "RESOLVED_PAIR"
            ]
          },
          "labelSimilarity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "shapeMatch": {
            "type": "boolean"
          },
          "differences": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "type": "string",
              "enum": [
                "label",
                "description",
                "targetGrammar",
                "identityRoleKeys",
                "exclusiveScopes",
                "relatedScopes",
                "phases",
                "lease"
              ]
            }
          },
          "semantics": {
            "type": "object",
            "description": "The candidate’s complete bounded semantics for side-by-side comparison.",
            "required": [
              "description",
              "targetGrammar",
              "identityRoleKeys",
              "exclusiveScopes",
              "relatedScopes",
              "phases",
              "leaseTtlSeconds",
              "leaseHeartbeatSeconds"
            ],
            "additionalProperties": false,
            "properties": {
              "description": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 10000
              },
              "targetGrammar": {
                "type": "array",
                "minItems": 1,
                "maxItems": 12,
                "uniqueItems": true,
                "description": "Canonical invariants (server-enforced, cross-field): role keys are unique and at least ONE role is required; identityRoleKeys and every ROLE exclusive scope name required grammar roles; every ROLE related scope names a grammar role.",
                "items": {
                  "type": "object",
                  "required": [
                    "roleKey",
                    "kind",
                    "required"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "roleKey": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,59}$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "contract",
                        "proposal",
                        "person",
                        "job",
                        "ops_action",
                        "ops_observation",
                        "ops_decision",
                        "ops_work_execution"
                      ],
                      "description": "CLOSED platform target kind (entity vocabulary, never a work type)."
                    },
                    "required": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "identityRoleKeys": {
                "type": "array",
                "minItems": 1,
                "maxItems": 12,
                "uniqueItems": true,
                "description": "Unique role keys that compose the canonical identity — each MUST be a REQUIRED role of targetGrammar (server-enforced cross-field invariant).",
                "items": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,59}$"
                }
              },
              "exclusiveScopes": {
                "type": "array",
                "maxItems": 12,
                "uniqueItems": true,
                "description": "Unique scope templates: a ROLE scope names a grammar role (an EXCLUSIVE ROLE scope must name a REQUIRED role — server-enforced cross-field invariant); a JOB scope carries no role key.",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "scope",
                        "roleKey"
                      ],
                      "properties": {
                        "scope": {
                          "type": "string",
                          "enum": [
                            "ROLE"
                          ]
                        },
                        "roleKey": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,59}$"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "scope"
                      ],
                      "properties": {
                        "scope": {
                          "type": "string",
                          "enum": [
                            "JOB"
                          ]
                        }
                      }
                    }
                  ]
                }
              },
              "relatedScopes": {
                "type": "array",
                "maxItems": 12,
                "uniqueItems": true,
                "description": "Unique scope templates: a ROLE scope names a grammar role (an EXCLUSIVE ROLE scope must name a REQUIRED role — server-enforced cross-field invariant); a JOB scope carries no role key.",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "scope",
                        "roleKey"
                      ],
                      "properties": {
                        "scope": {
                          "type": "string",
                          "enum": [
                            "ROLE"
                          ]
                        },
                        "roleKey": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,59}$"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "scope"
                      ],
                      "properties": {
                        "scope": {
                          "type": "string",
                          "enum": [
                            "JOB"
                          ]
                        }
                      }
                    }
                  ]
                }
              },
              "phases": {
                "type": "array",
                "maxItems": 20,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                }
              },
              "leaseTtlSeconds": {
                "type": "integer",
                "minimum": 1
              },
              "leaseHeartbeatSeconds": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            }
          },
          "resolution": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "decisionId",
                  "outcome",
                  "selectedDefinitionKey",
                  "resolvedByUserId",
                  "resolvedAt",
                  "bindingCurrent"
                ],
                "additionalProperties": false,
                "properties": {
                  "decisionId": {
                    "type": "string"
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "DISTINCT",
                      "DUPLICATE"
                    ]
                  },
                  "selectedDefinitionKey": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "C-DEV3191-087: for DUPLICATE, the definition that stays (exactly one of the pair); the other is the retired proposal. Null for DISTINCT."
                  },
                  "resolvedByUserId": {
                    "type": "string"
                  },
                  "resolvedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "bindingCurrent": {
                    "type": "boolean",
                    "description": "C-DEV3191-091: true only while the LATEST version of BOTH definitions still carries exactly the semantics (content hash + coordination signature) this decision bound. False means a side moved: the judgement is stale, reads as unresolved, never authorizes approval/activation, and a fresh human resolution is mandatory. The bound versions themselves are never published."
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsWorkDuplicateBlocker": {
        "description": "C-DEV3191-087/093: the operational blocker a CURRENT DUPLICATE resolution imposes on the subject — the closed mirror of the canonical fence.",
        "oneOf": [
          {
            "type": "object",
            "required": [
              "kind",
              "decisionId",
              "selectedDefinitionKey",
              "selectedDefinitionStatus"
            ],
            "additionalProperties": false,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RETIRED"
                ]
              },
              "decisionId": {
                "type": "string"
              },
              "selectedDefinitionKey": {
                "type": "string"
              },
              "selectedDefinitionStatus": {
                "type": "string",
                "enum": [
                  "DRAFT",
                  "ACTIVE",
                  "ARCHIVED"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind",
              "decisionId",
              "retiredDefinitionKey"
            ],
            "additionalProperties": false,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SELECTED_AWAITING_RETIREMENT"
                ]
              },
              "decisionId": {
                "type": "string"
              },
              "retiredDefinitionKey": {
                "type": "string"
              }
            }
          }
        ]
      },
      "JobOpsWorkDuplicateCandidatePacket": {
        "type": "object",
        "description": "RC10 (C-DEV3191-079/093): one closed, completeness-honest packet of possible duplicates for a definition. `candidates` is one PRIORITY page (blockers, then candidates needing a decision, then safely resolved rows) so resolving what is visible surfaces the next unresolved rows; the full-set counts say what remains. The subject is approvable/activatable ONLY when candidatesComplete and resolutionsComplete are true, blockers is empty, and unresolvedCandidateCount is 0 — however many historical safe resolutions exist beyond the page.",
        "required": [
          "candidates",
          "candidatesComplete",
          "resolutionsComplete",
          "comparedDefinitionCount",
          "skippedUnreadableCount",
          "candidateCount",
          "unresolvedCandidateCount",
          "hasMore",
          "blockers",
          "advisory"
        ],
        "additionalProperties": false,
        "properties": {
          "candidates": {
            "type": "array",
            "maxItems": 5,
            "description": "C-DEV3191-100: the MANDATORY court only — meaningful deterministic label similarity (relation SIMILAR_LABEL_SAME_SHAPE or SIMILAR_LABEL_DIFFERENT_SHAPE). Every entry needs a CURRENT human resolution before approval. The court partition is CLOSED: a row here never carries an advisory relation, an advisory row never carries a mandatory one, and every parser rejects a packet that violates the partition.",
            "items": {
              "$ref": "#/components/schemas/JobOpsWorkDuplicateCandidate"
            }
          },
          "advisory": {
            "type": "object",
            "description": "C-DEV3191-100: explicitly NONBLOCKING evidence — same-shape/dissimilar-wording pairs and previously resolved pairs that no longer relate. Bounded to one page with an honest count; its completeness never fences approval and never forces a pair-policy write. A human MAY still resolve an advisory pair; a CURRENT DUPLICATE on any pair is honored in `blockers`.",
            "required": [
              "candidates",
              "count",
              "complete"
            ],
            "additionalProperties": false,
            "properties": {
              "candidates": {
                "type": "array",
                "maxItems": 5,
                "description": "Advisory relations only (SAME_SHAPE_DISSIMILAR_LABEL or RESOLVED_PAIR); each row keeps its exact relation label.",
                "items": {
                  "$ref": "#/components/schemas/JobOpsWorkDuplicateCandidate"
                }
              },
              "count": {
                "type": "integer",
                "minimum": 0
              },
              "complete": {
                "type": "boolean"
              }
            }
          },
          "candidatesComplete": {
            "type": "boolean",
            "description": "Whether the comparison SET was fully read and parsed: false when the live catalog exceeded the scan capacity or a definition was unreadable. Never about the page size (see hasMore)."
          },
          "resolutionsComplete": {
            "type": "boolean",
            "description": "C-DEV3191-084: false when the bounded resolution projection for the visible pairs truncated or held conflicting/poisoned rows — then every resolution in this packet is null."
          },
          "comparedDefinitionCount": {
            "type": "integer",
            "minimum": 0
          },
          "skippedUnreadableCount": {
            "type": "integer",
            "minimum": 0
          },
          "candidateCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Total candidates in the complete set (the page shows the first ones)."
          },
          "unresolvedCandidateCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Total candidates (complete set) still waiting for a human decision: no resolution, or a resolution whose bindings moved."
          },
          "hasMore": {
            "type": "boolean",
            "description": "True when candidateCount exceeds the page."
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsWorkDuplicateBlocker"
            },
            "description": "Operational blockers from CURRENT DUPLICATE resolutions over the complete set."
          }
        }
      },
      "JobOpsWorkDefinitionSummary": {
        "type": "object",
        "description": "One per-job Work Definition head with its CURRENT (active) and LATEST (lineage-head) version summaries — the two semantic heads different mutations bind. RC10: `duplicateCandidates` is present for a pending INFERRED proposal head, null otherwise.",
        "required": [
          "definitionKey",
          "status",
          "revision",
          "migrationInProgress",
          "createdAt",
          "createdByUserId",
          "createdByAgentLabel",
          "currentVersion",
          "latestVersion",
          "duplicateCandidates"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "migrationInProgress": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "type": "string"
          },
          "createdByAgentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "currentVersion": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "latestVersion": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "duplicateCandidates": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkDuplicateCandidatePacket"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsWorkDefinitionListPage": {
        "type": "object",
        "required": [
          "contextRevision",
          "definitions",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "definitions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/JobOpsWorkDefinitionSummary"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsWorkDefinitionDetailResponse": {
        "type": "object",
        "required": [
          "contextRevision",
          "definition"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "definition": {
            "type": "object",
            "required": [
              "definitionKey",
              "status",
              "revision",
              "migrationInProgress",
              "createdAt",
              "createdByUserId",
              "createdByAgentLabel",
              "currentVersion",
              "latestVersion",
              "versions",
              "versionsHasMore",
              "nextVersionsCursor",
              "duplicateCandidates"
            ],
            "additionalProperties": false,
            "properties": {
              "definitionKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
              },
              "status": {
                "type": "string",
                "enum": [
                  "DRAFT",
                  "ACTIVE",
                  "ARCHIVED"
                ]
              },
              "revision": {
                "type": "integer",
                "minimum": 0
              },
              "migrationInProgress": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "createdByUserId": {
                "type": "string"
              },
              "createdByAgentLabel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currentVersion": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JobOpsWorkVersionDetail"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "latestVersion": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JobOpsWorkVersionDetail"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "versions": {
                "type": "array",
                "maxItems": 50,
                "description": "Hard-bounded keyset-paged history slice, newest first.",
                "items": {
                  "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
                }
              },
              "versionsHasMore": {
                "type": "boolean"
              },
              "nextVersionsCursor": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "duplicateCandidates": {
                "description": "RC10 (C-DEV3191-079): attributed possible duplicates of the LATEST version; null when the definition has no readable latest version.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JobOpsWorkDuplicateCandidatePacket"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      },
      "JobOpsWorkExecutionRecord": {
        "type": "object",
        "description": "One Work Execution with its pinned definition binding and its ONE coordinating action (single claim authority) including the verified live claim/reservation projection.",
        "required": [
          "id",
          "status",
          "provisional",
          "provisionalLabel",
          "phase",
          "subjectPersonUserId",
          "serverKey",
          "keyComputationVersion",
          "validatedTargets",
          "validatedTargetsValid",
          "expiresAt",
          "completedAt",
          "outcome",
          "supersededByExecutionId",
          "evidenceRefs",
          "createdAt",
          "createdByUserId",
          "createdByAgentLabel",
          "revision",
          "definition",
          "coordinatingAction"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "COMPLETED",
              "CANCELED",
              "SUPERSEDED"
            ]
          },
          "provisional": {
            "type": "boolean"
          },
          "provisionalLabel": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 300
          },
          "phase": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 120
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "serverKey": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "keyComputationVersion": {
            "type": "integer",
            "minimum": 1
          },
          "validatedTargets": {
            "oneOf": [
              {
                "type": "object",
                "minProperties": 1,
                "maxProperties": 12,
                "propertyNames": {
                  "pattern": "^[a-z][a-z0-9_]{0,59}$"
                },
                "additionalProperties": {
                  "type": "object",
                  "required": [
                    "kind",
                    "entityId"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "contract",
                        "proposal",
                        "person",
                        "job",
                        "ops_action",
                        "ops_observation",
                        "ops_decision",
                        "ops_work_execution"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "pattern": "^[^*?%]+$"
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "validatedTargetsValid": {
            "type": "boolean",
            "description": "False when the persisted targets failed the closed grammar (validatedTargets is then null) — never raw passthrough."
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ]
          },
          "supersededByExecutionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "type": "string"
          },
          "createdByAgentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "definition": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "definitionKey",
                  "definitionStatus",
                  "versionId",
                  "versionNumber",
                  "label",
                  "leaseTtlSeconds",
                  "contentHash",
                  "coordinationSignature"
                ],
                "additionalProperties": false,
                "properties": {
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "definitionStatus": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "ACTIVE",
                      "ARCHIVED"
                    ]
                  },
                  "versionId": {
                    "type": "string"
                  },
                  "versionNumber": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300,
                    "pattern": "\\S"
                  },
                  "leaseTtlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 14400
                  },
                  "contentHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "coordinationSignature": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "coordinatingAction": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsAction"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsWorkExecutionListPage": {
        "type": "object",
        "required": [
          "contextRevision",
          "executions",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "executions": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/JobOpsWorkExecutionRecord"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsWorkExecutionMutationRecord": {
        "type": "object",
        "description": "The execution row a begin/promote mutation returns (closed serializer).",
        "required": [
          "id",
          "status",
          "provisional",
          "provisionalLabel",
          "phase",
          "subjectPersonUserId",
          "serverKey",
          "keyComputationVersion",
          "validatedTargets",
          "validatedTargetsValid",
          "definitionVersionId",
          "expiresAt",
          "completedAt",
          "outcome",
          "supersededByExecutionId",
          "evidenceRefs",
          "createdAt",
          "createdByUserId",
          "createdByAgentLabel",
          "revision"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "COMPLETED",
              "CANCELED",
              "SUPERSEDED"
            ]
          },
          "provisional": {
            "type": "boolean"
          },
          "provisionalLabel": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 300
          },
          "phase": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 120
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "serverKey": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "keyComputationVersion": {
            "type": "integer",
            "minimum": 1
          },
          "validatedTargets": {
            "oneOf": [
              {
                "type": "object",
                "minProperties": 1,
                "maxProperties": 12,
                "propertyNames": {
                  "pattern": "^[a-z][a-z0-9_]{0,59}$"
                },
                "additionalProperties": {
                  "type": "object",
                  "required": [
                    "kind",
                    "entityId"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "contract",
                        "proposal",
                        "person",
                        "job",
                        "ops_action",
                        "ops_observation",
                        "ops_decision",
                        "ops_work_execution"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "pattern": "^[^*?%]+$"
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "validatedTargetsValid": {
            "type": "boolean"
          },
          "definitionVersionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ]
          },
          "supersededByExecutionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "type": "string"
          },
          "createdByAgentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobOpsWorkDefinitionCreateResult": {
        "type": "object",
        "required": [
          "definition",
          "version",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "definition": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "definitionKey",
                  "status",
                  "revision",
                  "createdAt",
                  "createdByUserId"
                ],
                "additionalProperties": false,
                "properties": {
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "ACTIVE",
                      "ARCHIVED"
                    ]
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "createdByUserId": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkVersionAppendResult": {
        "type": "object",
        "required": [
          "version",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "version": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkActivateResult": {
        "type": "object",
        "required": [
          "definitionKey",
          "activatedVersionId",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
          },
          "activatedVersionId": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkArchiveResult": {
        "type": "object",
        "required": [
          "definitionKey",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkProposeResult": {
        "type": "object",
        "description": "DRAFT proposal from provisional work — or the typed convergence outcome naming the definition the SAME provisional source already derived. RC10: `duplicateCandidates` names ATTRIBUTED possible duplicates of the proposal (bounded, completeness-honest); it never merges or declares equivalence.",
        "required": [
          "definition",
          "version",
          "convergedOn",
          "duplicateCandidates",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "duplicateCandidates": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkDuplicateCandidatePacket"
              },
              {
                "type": "null"
              }
            ]
          },
          "definition": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "definitionKey",
                  "status",
                  "revision",
                  "createdAt",
                  "createdByUserId"
                ],
                "additionalProperties": false,
                "properties": {
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "ACTIVE",
                      "ARCHIVED"
                    ]
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "createdByUserId": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkVersionSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "convergedOn": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "definitionKey",
                  "definitionStatus",
                  "reason"
                ],
                "additionalProperties": false,
                "properties": {
                  "definitionKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
                  },
                  "definitionStatus": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "ACTIVE",
                      "ARCHIVED"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "SAME_PROVISIONAL_SOURCE"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkExecutionBeginResult": {
        "type": "object",
        "required": [
          "execution",
          "action",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "execution": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkExecutionMutationRecord"
              },
              {
                "type": "null"
              }
            ]
          },
          "action": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsAction"
              },
              {
                "type": "null"
              }
            ]
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkExecutionPromoteResult": {
        "type": "object",
        "required": [
          "execution",
          "action",
          "supersededExecutionId",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "execution": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsWorkExecutionMutationRecord"
              },
              {
                "type": "null"
              }
            ]
          },
          "action": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsAction"
              },
              {
                "type": "null"
              }
            ]
          },
          "supersededExecutionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkMigrationStartResult": {
        "type": "object",
        "required": [
          "definitionKey",
          "frozen",
          "converged",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
          },
          "frozen": {
            "type": "boolean"
          },
          "converged": {
            "type": "boolean"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsWorkMigrationBatchResult": {
        "type": "object",
        "required": [
          "definitionKey",
          "migratedCount",
          "remainingCount",
          "completed",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-z0-9][a-z0-9_-]{0,79}$"
          },
          "migratedCount": {
            "type": "integer",
            "minimum": 0
          },
          "remainingCount": {
            "type": "integer",
            "minimum": 0
          },
          "completed": {
            "type": "boolean"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsActionRenewResult": {
        "type": "object",
        "description": "The renewed action (verified reservation projection) plus the FRESH renewal receipt — monotonic, statement-clock fenced, replayable.",
        "required": [
          "id",
          "createdAt",
          "updatedAt",
          "titleText",
          "descriptionText",
          "statusText",
          "priorityText",
          "subjectPersonUserId",
          "assignedOwnerText",
          "dueAt",
          "dependsOnJson",
          "evidenceRefsJson",
          "claimOwnerText",
          "claimedByUserId",
          "claimedAt",
          "claimExpiresAt",
          "completedAt",
          "completedByText",
          "outcomeText",
          "canceledAt",
          "canceledByUserId",
          "createdByUserId",
          "sourceSignalId",
          "signalActionAttemptNumber",
          "workExecutionId",
          "handoffReservedForUserId",
          "handoffReservedByUserId",
          "handoffReservationExpiresAt",
          "handoffReservationHandoffId",
          "handoffReservationInstructions",
          "revision",
          "claimReceipt",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "titleText": {
            "type": "string"
          },
          "descriptionText": {
            "type": [
              "string",
              "null"
            ]
          },
          "statusText": {
            "type": "string",
            "enum": [
              "OPEN",
              "CLAIMED",
              "COMPLETED",
              "CANCELED"
            ]
          },
          "priorityText": {
            "type": "string",
            "enum": [
              "LOW",
              "NORMAL",
              "HIGH",
              "URGENT"
            ]
          },
          "subjectPersonUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assignedOwnerText": {
            "type": [
              "string",
              "null"
            ]
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dependsOnJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Same-context action ids this action depends on."
          },
          "evidenceRefsJson": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "claimOwnerText": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "claimedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "claimExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedByText": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcomeText": {
            "type": [
              "string",
              "null"
            ]
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "canceledByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByUserId": {
            "type": "string"
          },
          "sourceSignalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Frozen attention-signal linkage: signal ownership is derived from the latest linked action attempt."
          },
          "signalActionAttemptNumber": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "workExecutionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Frozen work-execution linkage: when set, this action is the single claim authority for that execution."
          },
          "handoffReservedForUserId": {
            "type": [
              "string",
              "null"
            ],
            "description": "LIVE targeted claim-handoff reservation: the named recipient who may claim this OPEN action until the window expires."
          },
          "handoffReservedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "handoffReservationExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "handoffReservationHandoffId": {
            "type": [
              "string",
              "null"
            ]
          },
          "handoffReservationInstructions": {
            "type": [
              "object",
              "null"
            ],
            "description": "Verified handoff instructions for the live claim reservation (summary, bounded open items, sanitized evidence refs). Null unless a verified reservation exists.",
            "additionalProperties": false,
            "required": [
              "summary",
              "openItems",
              "evidenceRefs"
            ],
            "properties": {
              "summary": {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000
              },
              "openItems": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2000
                }
              },
              "evidenceRefs": {
                "type": "array",
                "maxItems": 50,
                "items": {
                  "$ref": "#/components/schemas/JobOpsEvidenceRef"
                }
              }
            }
          },
          "revision": {
            "type": "integer",
            "description": "Current action revision — send back as expectedActionRevision."
          },
          "claimReceipt": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsActionHandoffResult": {
        "type": "object",
        "description": "Two-phase claim handoff outcome: the released OPEN action carrying the visible recipient reservation + verified instructions, the audit record id, and the window expiry. No receipt ever transfers.",
        "required": [
          "action",
          "handoffId",
          "windowExpiresAt",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "action": {
            "$ref": "#/components/schemas/JobOpsAction"
          },
          "handoffId": {
            "type": "string"
          },
          "windowExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSyncActiveClaimHandoffEntry": {
        "type": "object",
        "description": "One LIVE targeted claim-handoff reservation (strict closed projection): an OPEN action reserved for a named recipient until the window expires, carrying the VERIFIED handoff instructions from the immutable audit record. Contains no secret and no raw metadata; a poisoned stored field reads as null with entryValid=false.",
        "required": [
          "actionId",
          "workExecutionId",
          "toUserId",
          "fromUserId",
          "expiresAt",
          "handoffId",
          "summary",
          "openItems",
          "evidenceRefs",
          "entryValid"
        ],
        "additionalProperties": false,
        "properties": {
          "actionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "workExecutionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "toUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fromUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "handoffId": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ]
          },
          "openItems": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2000
            }
          },
          "evidenceRefs": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "entryValid": {
            "type": "boolean"
          }
        }
      },
      "JobOpsSyncEnvelope": {
        "type": "object",
        "description": "The automatic synchronization envelope attached to every covered job-scoped operation. Presenting `syncToken` on a later request acknowledges exactly the delivered range (two-phase); generating a response never advances the durable cursor.",
        "required": [
          "schemaVersion",
          "jobId",
          "contextExists",
          "contextRevision",
          "session",
          "syncToken",
          "syncTokenExpiresAt",
          "presentedTokenProblem",
          "acknowledgedRevision",
          "bootstrap",
          "resyncRequired",
          "nextOperations",
          "changes",
          "policyGuide",
          "activeClaims",
          "activeClaimHandoffs",
          "activeIntents",
          "proposals",
          "workCatalog",
          "conflicts",
          "recommendations",
          "sourceHealth"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "jobId": {
            "type": "string"
          },
          "contextExists": {
            "type": "boolean"
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "session": {
            "$ref": "#/components/schemas/JobOpsSyncSessionInfo"
          },
          "syncToken": {
            "type": "string"
          },
          "syncTokenExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "presentedTokenProblem": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "MALFORMED",
                  "BAD_SIGNATURE",
                  "KEY_ROTATED",
                  "EXPIRED",
                  "BINDING_MISMATCH"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "acknowledgedRevision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "bootstrap": {
            "type": "boolean"
          },
          "resyncRequired": {
            "type": "boolean"
          },
          "nextOperations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "changes": {
            "type": "object",
            "required": [
              "baseline",
              "fromRevision",
              "toRevision",
              "entries",
              "hasMore"
            ],
            "additionalProperties": false,
            "properties": {
              "baseline": {
                "type": "string",
                "enum": [
                  "CURSOR",
                  "TOKEN",
                  "BOOTSTRAP_TAIL"
                ]
              },
              "fromRevision": {
                "type": "integer",
                "minimum": 0
              },
              "toRevision": {
                "type": "integer",
                "minimum": 0
              },
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JobOpsSyncChangeEntry"
                }
              },
              "hasMore": {
                "type": "boolean"
              }
            }
          },
          "policyGuide": {
            "type": "object",
            "required": [
              "briefRevision",
              "latestPolicyDecisionId",
              "changedSinceFrom"
            ],
            "additionalProperties": false,
            "properties": {
              "briefRevision": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "latestPolicyDecisionId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "changedSinceFrom": {
                "type": "boolean"
              }
            }
          },
          "activeClaims": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsSyncActiveClaimEntry"
            }
          },
          "activeClaimHandoffs": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/JobOpsSyncActiveClaimHandoffEntry"
            }
          },
          "activeIntents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsSyncActiveIntentEntry"
            }
          },
          "proposals": {
            "type": "object",
            "required": [
              "openCount",
              "top"
            ],
            "additionalProperties": false,
            "properties": {
              "openCount": {
                "type": "integer",
                "minimum": 0
              },
              "top": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JobOpsSyncProposalEntry"
                }
              }
            }
          },
          "workCatalog": {
            "$ref": "#/components/schemas/JobOpsWorkCatalogSummary"
          },
          "conflicts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsSyncConflict"
            }
          },
          "recommendations": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/JobOpsSyncRecommendation"
            }
          },
          "sourceHealth": {
            "$ref": "#/components/schemas/JobOpsSyncSourceHealth"
          }
        }
      },
      "JobOpsIntentPublicView": {
        "type": "object",
        "description": "One write-ahead intent (public strict projection; lazy expiry is reported through effectiveStatus, never written from a read).",
        "required": [
          "intentId",
          "createdAt",
          "kind",
          "intentKey",
          "title",
          "body",
          "target",
          "targetValid",
          "capabilityOperationId",
          "declaredAtRevision",
          "expiresAt",
          "status",
          "effectiveStatus",
          "promotedActionId",
          "resolvedAt",
          "resolvedByUserId",
          "resolvedByAgentLabel",
          "resolutionNote",
          "principalUserId",
          "agentLabel",
          "sessionId",
          "revision"
        ],
        "additionalProperties": false,
        "properties": {
          "intentId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "enum": [
              "MESSAGE_SEND",
              "POLICY_RECORD",
              "WORKFLOW_CHANGE",
              "ACTION_WORK",
              "CAPABILITY_EXECUTION",
              "OTHER"
            ]
          },
          "intentKey": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "target": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "personUserId": {
                    "type": "string"
                  },
                  "actionId": {
                    "type": "string"
                  },
                  "signalId": {
                    "type": "string"
                  },
                  "conversationId": {
                    "type": "string"
                  },
                  "refs": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/JobOpsEvidenceRef"
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "targetValid": {
            "type": "boolean"
          },
          "capabilityOperationId": {
            "type": [
              "string",
              "null"
            ]
          },
          "declaredAtRevision": {
            "type": "integer",
            "minimum": 0
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PROMOTED",
              "COMPLETED",
              "ABANDONED",
              "EXPIRED",
              "REJECTED"
            ]
          },
          "effectiveStatus": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PROMOTED",
              "COMPLETED",
              "ABANDONED",
              "EXPIRED",
              "REJECTED"
            ]
          },
          "promotedActionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolvedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolvedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolvedByAgentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "principalUserId": {
            "type": "string"
          },
          "agentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "sessionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobOpsProposalPublicView": {
        "type": "object",
        "description": "One non-enforced proposal (public strict projection). Poisoned or non-deterministic stored values read as null with the matching *Valid flag false — never coerced.",
        "required": [
          "proposalId",
          "createdAt",
          "kind",
          "dedupeKey",
          "title",
          "body",
          "payload",
          "payloadValid",
          "evidenceRefs",
          "evidenceRefsValid",
          "capabilityOperationId",
          "executionGuard",
          "priorityScore",
          "priorityBand",
          "priorityFactors",
          "priorityFactorsValid",
          "declaredAtRevision",
          "status",
          "effectiveStatus",
          "proposalValid",
          "sessionId",
          "proposedByUserId",
          "proposedByAgentLabel",
          "resultingDecisionId",
          "resultingActionId",
          "resultingBriefRevision",
          "resolvedAt",
          "resolvedByUserId",
          "resolutionNote",
          "expiresAt",
          "revision"
        ],
        "additionalProperties": false,
        "properties": {
          "proposalId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "POLICY",
                  "WORKFLOW",
                  "PRIORITY",
                  "GOAL",
                  "EXCEPTION",
                  "CAPABILITY_EXECUTION"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "dedupeKey": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "payload": {
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "payloadValid": {
            "type": "boolean"
          },
          "evidenceRefs": {
            "type": "array",
            "items": {}
          },
          "evidenceRefsValid": {
            "type": "boolean"
          },
          "capabilityOperationId": {
            "type": [
              "string",
              "null"
            ]
          },
          "executionGuard": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "AUTO_REVERSIBLE",
                  "EXPLICIT_APPROVAL",
                  "HUMAN_COSIGN",
                  "OWNER_GATED",
                  "PROHIBITED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "priorityScore": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "priorityBand": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "P0",
                  "P1",
                  "P2",
                  "P3"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "priorityFactors": {
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "priorityFactorsValid": {
            "type": "boolean"
          },
          "declaredAtRevision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "OPEN",
                  "ACCEPTED",
                  "DECLINED",
                  "WITHDRAWN",
                  "EXPIRED",
                  "SUPERSEDED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "effectiveStatus": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "OPEN",
                  "ACCEPTED",
                  "DECLINED",
                  "WITHDRAWN",
                  "EXPIRED",
                  "SUPERSEDED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "proposalValid": {
            "type": "boolean"
          },
          "sessionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposedByUserId": {
            "type": "string"
          },
          "proposedByAgentLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "resultingDecisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "resultingActionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "resultingBriefRevision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "resolvedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolvedByUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "JobOpsSyncPollResult": {
        "type": "object",
        "description": "Long-poll wake signal. The attached `sync` envelope is the authoritative payload; this body only says whether (and how long) the poll waited.",
        "required": [
          "contextRevision",
          "changed",
          "waitedMs",
          "baselineRevision"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "boolean"
          },
          "waitedMs": {
            "type": "integer",
            "minimum": 0
          },
          "baselineRevision": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "JobOpsIntentDeclareResult": {
        "type": "object",
        "description": "Declared/replayed intent, or the typed DUPLICATE loser packet naming the live winner's attribution.",
        "required": [
          "outcome",
          "contextRevision",
          "conflict",
          "intent"
        ],
        "additionalProperties": false,
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "DECLARED",
              "REPLAYED",
              "DUPLICATE"
            ]
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "conflict": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsSyncConflict"
              },
              {
                "type": "null"
              }
            ]
          },
          "intent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsIntentPublicView"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsIntentListPage": {
        "type": "object",
        "required": [
          "contextRevision",
          "intents",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "intents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsIntentPublicView"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsIntentResolveResult": {
        "type": "object",
        "required": [
          "contextRevision",
          "replayed",
          "intent"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "replayed": {
            "type": "boolean"
          },
          "intent": {
            "$ref": "#/components/schemas/JobOpsIntentPublicView"
          }
        }
      },
      "JobOpsProposalSubmitResult": {
        "type": "object",
        "description": "Submitted/replayed proposal, or DEDUPLICATED with the existing live OPEN head under the same dedupe key.",
        "required": [
          "outcome",
          "contextRevision",
          "proposal"
        ],
        "additionalProperties": false,
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "SUBMITTED",
              "REPLAYED",
              "DEDUPLICATED"
            ]
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "proposal": {
            "$ref": "#/components/schemas/JobOpsProposalPublicView"
          }
        }
      },
      "JobOpsProposalListPage": {
        "type": "object",
        "required": [
          "contextRevision",
          "proposals",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "proposals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsProposalPublicView"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsProposalReviewResult": {
        "type": "object",
        "required": [
          "contextRevision",
          "replayed",
          "proposal"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "replayed": {
            "type": "boolean"
          },
          "proposal": {
            "$ref": "#/components/schemas/JobOpsProposalPublicView"
          }
        }
      },
      "JobOpsGuideOverlayScopeView": {
        "type": "object",
        "description": "One overlay scope head: untrusted attributed content with deterministic typed-reference-only lint flags. Free text is never semantically adjudicated by the server.",
        "required": [
          "layer",
          "overlayRevision",
          "recordedAt",
          "attribution",
          "entries",
          "entriesValid"
        ],
        "additionalProperties": false,
        "properties": {
          "layer": {
            "type": "string",
            "enum": [
              "TEAM",
              "PERSONAL",
              "SESSION"
            ]
          },
          "overlayRevision": {
            "type": "integer",
            "minimum": 1
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time"
          },
          "attribution": {
            "type": "object",
            "required": [
              "createdByUserId",
              "createdByAgentText",
              "sessionId"
            ],
            "additionalProperties": false,
            "properties": {
              "createdByUserId": {
                "type": "string"
              },
              "createdByAgentText": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sessionId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "entry",
                "reviewStatus",
                "flags",
                "needsReview"
              ],
              "additionalProperties": false,
              "properties": {
                "entry": {
                  "type": "object",
                  "required": [
                    "kind",
                    "statement"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "REQUIREMENT",
                        "PROHIBITION",
                        "NOTE"
                      ]
                    },
                    "statement": {
                      "type": "string"
                    },
                    "rationale": {
                      "type": "string"
                    },
                    "relatedPolicyKey": {
                      "type": "string"
                    },
                    "relatedGateKey": {
                      "type": "string"
                    },
                    "relatedOperationId": {
                      "type": "string"
                    }
                  }
                },
                "reviewStatus": {
                  "type": "string",
                  "enum": [
                    "UNREVIEWED",
                    "REFERENCED"
                  ]
                },
                "flags": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "STALE_POLICY_REFERENCE",
                      "INVALID_REFERENCE",
                      "HIGHER_LAYER_REFERENCE",
                      "SOURCE_INCOMPLETE"
                    ]
                  }
                },
                "needsReview": {
                  "type": "boolean"
                }
              }
            }
          },
          "entriesValid": {
            "type": "boolean"
          }
        }
      },
      "JobOpsOverlaysResponse": {
        "type": "object",
        "description": "The caller-visible overlay stack: the shared TEAM head plus the caller's OWN personal head and credential-resolved session scratch, read in one coherent snapshot.",
        "required": [
          "contextRevision",
          "policyEvidenceComplete",
          "team",
          "personal",
          "session"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "policyEvidenceComplete": {
            "type": "boolean"
          },
          "team": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsGuideOverlayScopeView"
              },
              {
                "type": "null"
              }
            ]
          },
          "personal": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsGuideOverlayScopeView"
              },
              {
                "type": "null"
              }
            ]
          },
          "session": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsGuideOverlayScopeView"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsOverlaySetResult": {
        "type": "object",
        "required": [
          "contextRevision",
          "replayed",
          "overlay"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "replayed": {
            "type": "boolean"
          },
          "overlay": {
            "type": "object",
            "required": [
              "overlayId",
              "layer",
              "scopeKey",
              "overlayRevision",
              "recordedAt"
            ],
            "additionalProperties": false,
            "properties": {
              "overlayId": {
                "type": "string"
              },
              "layer": {
                "type": "string",
                "enum": [
                  "TEAM",
                  "PERSONAL",
                  "SESSION"
                ]
              },
              "scopeKey": {
                "type": "string"
              },
              "overlayRevision": {
                "type": "integer",
                "minimum": 1
              },
              "recordedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "JobOpsPlaybookAttribution": {
        "type": "object",
        "description": "Who performed a Playbook write: the accountable user and, when an agent acted under that user’s authority, its label (null for a direct human write).",
        "required": [
          "userId",
          "agentLabel"
        ],
        "additionalProperties": false,
        "properties": {
          "userId": {
            "type": "string"
          },
          "agentLabel": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobOpsPlaybookSection": {
        "type": "object",
        "description": "One canonical Markdown Playbook section (heading line included) with its stable id and SHA-256 content hash — never editor JSON, never raw HTML. Identical content hashes identically regardless of who published it.",
        "required": [
          "sectionId",
          "level",
          "heading",
          "markdown",
          "contentHash"
        ],
        "additionalProperties": false,
        "properties": {
          "sectionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6
          },
          "heading": {
            "type": "string",
            "maxLength": 200
          },
          "markdown": {
            "type": "string",
            "maxLength": 12000
          },
          "contentHash": {
            "type": "string",
            "description": "SHA-256 hex over the exact section Markdown."
          }
        }
      },
      "JobOpsPlaybookSectionDelta": {
        "type": "object",
        "description": "Section-level delta versus the superseded version. removedSectionIds are TOMBSTONES: ids an agent may still hold that no longer exist.",
        "required": [
          "addedSectionIds",
          "changedSectionIds",
          "removedSectionIds"
        ],
        "additionalProperties": false,
        "properties": {
          "addedSectionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "changedSectionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "removedSectionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JobOpsPlaybookVersion": {
        "type": "object",
        "description": "One immutable published Playbook version exactly as agents receive it (closed serializer): sections, hashes, version, publisher attribution, and delta. contentValid=false means the stored row failed strict re-validation — sections are then empty, never a silently valid empty Playbook.",
        "required": [
          "schemaVersion",
          "jobId",
          "playbookVersion",
          "contentHash",
          "contentValid",
          "publishedAt",
          "publishedBy",
          "publicationNote",
          "supersedesVersion",
          "contextRevision",
          "sectionCount",
          "sections",
          "delta",
          "acceptedProposalIds",
          "authority",
          "precedenceNotice"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "jobId": {
            "type": "string"
          },
          "playbookVersion": {
            "type": "integer",
            "minimum": 1
          },
          "contentHash": {
            "type": "string",
            "description": "SHA-256 over the ordered (sectionId, contentHash) pairs."
          },
          "contentValid": {
            "type": "boolean"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time"
          },
          "publishedBy": {
            "$ref": "#/components/schemas/JobOpsPlaybookAttribution"
          },
          "publicationNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "supersedesVersion": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "sectionCount": {
            "type": "integer",
            "minimum": 0
          },
          "sections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsPlaybookSection"
            }
          },
          "delta": {
            "$ref": "#/components/schemas/JobOpsPlaybookSectionDelta"
          },
          "acceptedProposalIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "authority": {
            "type": "string",
            "enum": [
              "GUIDANCE"
            ]
          },
          "precedenceNotice": {
            "type": "string"
          }
        }
      },
      "JobOpsPlaybookVersionSummary": {
        "type": "object",
        "description": "Bounded history row: the same closed validation as the full version, without sections.",
        "required": [
          "playbookVersion",
          "contentHash",
          "contentValid",
          "publishedAt",
          "publishedBy",
          "publicationNote",
          "supersedesVersion",
          "contextRevision",
          "sectionCount",
          "delta"
        ],
        "additionalProperties": false,
        "properties": {
          "playbookVersion": {
            "type": "integer",
            "minimum": 1
          },
          "contentHash": {
            "type": "string"
          },
          "contentValid": {
            "type": "boolean"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time"
          },
          "publishedBy": {
            "$ref": "#/components/schemas/JobOpsPlaybookAttribution"
          },
          "publicationNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "supersedesVersion": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "sectionCount": {
            "type": "integer",
            "minimum": 0
          },
          "delta": {
            "$ref": "#/components/schemas/JobOpsPlaybookSectionDelta"
          }
        }
      },
      "JobOpsPlaybookHead": {
        "type": "object",
        "description": "The current published Playbook head under a context-revision fence (published=null and the explicit empty-state Markdown when nothing is published yet).",
        "required": [
          "schemaVersion",
          "jobId",
          "contextRevision",
          "published",
          "markdown"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "jobId": {
            "type": "string"
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "published": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsPlaybookVersion"
              },
              {
                "type": "null"
              }
            ]
          },
          "markdown": {
            "type": "string"
          }
        }
      },
      "JobOpsPlaybookVersionsPage": {
        "type": "object",
        "description": "Newest-first bounded history; hasMore=true means older versions exist beyond the limit.",
        "required": [
          "contextRevision",
          "versions",
          "hasMore"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "versions": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/JobOpsPlaybookVersionSummary"
            }
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "JobOpsPlaybookVersionResponse": {
        "type": "object",
        "required": [
          "contextRevision",
          "version",
          "markdown"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "version": {
            "$ref": "#/components/schemas/JobOpsPlaybookVersion"
          },
          "markdown": {
            "type": "string"
          }
        }
      },
      "JobOpsPlaybookDelta": {
        "type": "object",
        "description": "Exact section delta between two published versions; fromVersion 0 means everything in toVersion is new. removedSectionIds are tombstones; sectionOrder is the full order at toVersion.",
        "required": [
          "schemaVersion",
          "jobId",
          "fromVersion",
          "toVersion",
          "toContentHash",
          "added",
          "changed",
          "removedSectionIds",
          "unchangedSectionIds",
          "sectionOrder"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "jobId": {
            "type": "string"
          },
          "fromVersion": {
            "type": "integer",
            "minimum": 0
          },
          "toVersion": {
            "type": "integer",
            "minimum": 1
          },
          "toContentHash": {
            "type": "string"
          },
          "added": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsPlaybookSection"
            }
          },
          "changed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobOpsPlaybookSection"
            }
          },
          "removedSectionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unchangedSectionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sectionOrder": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JobOpsPlaybookDeltaResponse": {
        "type": "object",
        "description": "delta is null only when no shared context exists yet and fromVersion is 0 (nothing to diff).",
        "required": [
          "contextRevision",
          "delta"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "delta": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsPlaybookDelta"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobOpsPlaybookPublishResult": {
        "type": "object",
        "description": "The published (or exactly replayed) version as the closed public projection — the submitted editor document is never echoed.",
        "required": [
          "contextRevision",
          "replayed",
          "version",
          "markdown"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "replayed": {
            "type": "boolean"
          },
          "version": {
            "$ref": "#/components/schemas/JobOpsPlaybookVersion"
          },
          "markdown": {
            "type": "string"
          }
        }
      },
      "JobOpsPlaybookProposedSection": {
        "type": "object",
        "description": "The section an agent proposed (SECTION_UPSERT), strictly re-validated with a RECOMPUTED full-section content hash so a human publication that lands the identical section hashes identically.",
        "required": [
          "level",
          "heading",
          "markdown",
          "contentHash"
        ],
        "additionalProperties": false,
        "properties": {
          "level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6
          },
          "heading": {
            "type": "string",
            "maxLength": 200
          },
          "markdown": {
            "type": "string",
            "maxLength": 12000
          },
          "contentHash": {
            "type": "string"
          }
        }
      },
      "JobOpsPlaybookProposal": {
        "type": "object",
        "description": "One attributable Playbook proposal or note (RECOMMENDED authority, never enforced). Poisoned stored values read as null with proposalValid=false — never coerced; evidenceRefs are re-parsed through the closed evidence schema.",
        "required": [
          "proposalId",
          "createdAt",
          "kind",
          "proposalValid",
          "dedupeKey",
          "sectionId",
          "basePlaybookVersion",
          "staleAgainstHead",
          "title",
          "body",
          "proposedSection",
          "evidenceRefs",
          "status",
          "proposedBy",
          "resultingPlaybookVersion",
          "resolvedAt",
          "resolvedBy",
          "resolutionNote",
          "expiresAt",
          "revision",
          "authority"
        ],
        "additionalProperties": false,
        "properties": {
          "proposalId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "SECTION_UPSERT",
                  "SECTION_REMOVE",
                  "NOTE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "proposalValid": {
            "type": "boolean"
          },
          "dedupeKey": {
            "type": "string"
          },
          "sectionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "basePlaybookVersion": {
            "type": "integer",
            "minimum": 0
          },
          "staleAgainstHead": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposedSection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsPlaybookProposedSection"
              },
              {
                "type": "null"
              }
            ]
          },
          "evidenceRefs": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/JobOpsEvidenceRef"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "ACCEPTED",
              "DECLINED",
              "WITHDRAWN",
              "EXPIRED",
              "SUPERSEDED"
            ]
          },
          "proposedBy": {
            "type": "object",
            "required": [
              "userId",
              "agentLabel",
              "sessionId"
            ],
            "additionalProperties": false,
            "properties": {
              "userId": {
                "type": "string"
              },
              "agentLabel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sessionId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "resultingPlaybookVersion": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "resolvedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "resolvedBy": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsPlaybookAttribution"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "authority": {
            "type": "string",
            "enum": [
              "RECOMMENDED"
            ]
          }
        }
      },
      "JobOpsPlaybookProposalSubmitResult": {
        "type": "object",
        "description": "Submitted/replayed proposal, or DEDUPLICATED with the existing live OPEN head under the same dedupe key.",
        "required": [
          "outcome",
          "contextRevision",
          "proposal"
        ],
        "additionalProperties": false,
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "SUBMITTED",
              "REPLAYED",
              "DEDUPLICATED"
            ]
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "proposal": {
            "$ref": "#/components/schemas/JobOpsPlaybookProposal"
          }
        }
      },
      "JobOpsPlaybookProposalListPage": {
        "type": "object",
        "description": "Oldest-first bounded proposal page with lazy effective expiry; headPlaybookVersion is the head every entry’s staleAgainstHead was judged against.",
        "required": [
          "contextRevision",
          "headPlaybookVersion",
          "proposals",
          "hasMore"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "headPlaybookVersion": {
            "type": "integer",
            "minimum": 0
          },
          "proposals": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/JobOpsPlaybookProposal"
            }
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "JobOpsPlaybookProposalResolveResult": {
        "type": "object",
        "required": [
          "contextRevision",
          "replayed",
          "proposal"
        ],
        "additionalProperties": false,
        "properties": {
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "replayed": {
            "type": "boolean"
          },
          "proposal": {
            "$ref": "#/components/schemas/JobOpsPlaybookProposal"
          }
        }
      },
      "JobOpsAgentGuide": {
        "type": "object",
        "description": "The composite Agent Guide: the deterministic canonical projection of typed authority PLUS the published Playbook head and the open Playbook-proposal count, under ONE context revision. checksum digests the canonical checksum, the Playbook version/hash, and the proposal count — never generatedAt. precedence lists the authority layers highest first; Playbook prose sits below every typed layer.",
        "required": [
          "schemaVersion",
          "jobId",
          "contextRevision",
          "checksum",
          "generatedAt",
          "precedence",
          "canonical",
          "playbook",
          "playbookProposals"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "jobId": {
            "type": "string"
          },
          "contextRevision": {
            "type": "integer",
            "minimum": 0
          },
          "checksum": {
            "type": "string"
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "precedence": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "PLATFORM_INVARIANTS",
                "APPLIED_SHARED_POLICY_WORKFLOW",
                "RECORDED_DECISIONS_EXCEPTIONS",
                "PUBLISHED_PLAYBOOK",
                "TEAM_OVERLAY",
                "PERSONAL_OVERLAY",
                "SESSION_SCRATCH"
              ]
            }
          },
          "canonical": {
            "$ref": "#/components/schemas/JobOpsOperatingGuide"
          },
          "playbook": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobOpsPlaybookVersion"
              },
              {
                "type": "null"
              }
            ]
          },
          "playbookProposals": {
            "type": "object",
            "required": [
              "openCount",
              "complete"
            ],
            "additionalProperties": false,
            "properties": {
              "openCount": {
                "type": "integer",
                "minimum": 0
              },
              "complete": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "JobOpsAgentGuideResponse": {
        "type": "object",
        "description": "The Agent Guide as structured JSON plus one deterministic Markdown rendering (canonical projection first, then the Playbook demoted under an explicit precedence notice).",
        "required": [
          "guide",
          "markdown"
        ],
        "additionalProperties": false,
        "properties": {
          "guide": {
            "$ref": "#/components/schemas/JobOpsAgentGuide"
          },
          "markdown": {
            "type": "string"
          }
        }
      },
      "CandidateIdentityVerdict": {
        "type": "object",
        "description": "The ONE shared candidate identity verdict (DEV-2922) returned identically by proposal detail, freelancer profile, and candidate dossier reads. `verified` is derived from `status` (never independently read); `source` names which policy branch answered; `conflict` carries status names only — never provider/session identifiers or document data.",
        "additionalProperties": false,
        "required": [
          "status",
          "verified",
          "provider",
          "countryCode",
          "verifiedAt",
          "expiresAt",
          "updatedAt",
          "current",
          "asOf",
          "source",
          "conflict",
          "nameMatchesProfile"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "REQUIRED_NOT_REQUESTED",
              "REQUESTED",
              "IN_PROGRESS",
              "VERIFIED",
              "FAILED",
              "EXPIRED",
              "NEEDS_REVIEW",
              "CANCELED",
              "NOT_REQUESTED",
              "UNKNOWN"
            ]
          },
          "verified": {
            "type": "boolean"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "DIDIT",
              "STRIPE_IDENTITY",
              null
            ]
          },
          "countryCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "current": {
            "type": "boolean",
            "description": "True only for an unexpired VERIFIED verdict as of `asOf`."
          },
          "asOf": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "enum": [
              "CANONICAL_VERIFICATION_RECORD",
              "LEGACY_STRIPE",
              "NONE"
            ]
          },
          "conflict": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "reason",
              "detail"
            ],
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "CANONICAL_LEGACY_DISAGREEMENT"
                ]
              },
              "detail": {
                "type": "string",
                "description": "Status names only."
              }
            }
          },
          "nameMatchesProfile": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "OPE-44675: whether the profile name matches the name on the verified ID. False means the Identity verified badge is hidden for this name; null means the verdict is not current or the name was never checked."
          }
        }
      },
      "CandidateProposalTimeLocation": {
        "type": "object",
        "description": "Historical location snapshot captured at proposal submission (scope PROPOSAL_TIME_SNAPSHOT); never current access.",
        "additionalProperties": false,
        "required": [
          "status",
          "method",
          "checkedAt",
          "scope"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PASSED",
              "FAILED",
              "NOT_RECORDED"
            ]
          },
          "method": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "GPS",
              "ID_DOCUMENT",
              "MIXED_SIGNALS",
              null
            ]
          },
          "checkedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "enum": [
              "PROPOSAL_TIME_SNAPSHOT"
            ]
          }
        }
      },
      "CandidateCurrentLocation": {
        "type": [
          "object",
          "null"
        ],
        "description": "Current location evaluation from the job-participation eligibility model.",
        "additionalProperties": false,
        "required": [
          "status",
          "evaluatedAt",
          "validUntil",
          "reasonCodes"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ELIGIBLE",
              "MISMATCH",
              "INSUFFICIENT_EVIDENCE",
              "REVIEW_REQUIRED"
            ]
          },
          "evaluatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "validUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reasonCodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CandidateProjectEligibility": {
        "type": [
          "object",
          "null"
        ],
        "description": "CandidateProjectEligibility is a stored job-scoped participation summary, separate from person-level identity, time-bounded currentLocation, proposal-time location snapshots, and screening results. null means no participation record is available, not eligible. evaluatedAt is the stored decision timestamp (or last evaluation), not the time of this read; use it as the freshness signal. reasonCodes are diagnostic reasons from that decision, not independent vetoes: ELIGIBLE can coexist with FULL_ID_REQUIRED or a location REVIEW_REQUIRED result under a non-enforced policy. Reads do not reevaluate the decision's freshness or grant access; active overrides are filtered for expiry at read time, and protected writes enforce current policy. DECISION_STALE is added only by the access guard; SCOPE_NOT_FOUND, SCOPE_MISMATCH and SCOPE_USER_MISMATCH are scope-resolution errors. These four codes are not emitted in this read. Always inspect identity, currentLocation and reasons separately; never infer verified identity, fresh location or permission to hire/work from this summary alone.",
        "additionalProperties": false,
        "required": [
          "status",
          "evaluatedAt",
          "reasonCodes"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ELIGIBLE",
              "ON_HOLD",
              "INELIGIBLE",
              "OVERRIDE_ACTIVE"
            ],
            "description": "ELIGIBLE: The stored job-participation decision allows participation and the participation is not ON_HOLD. This is not proof of verified identity or current location: a non-enforced (including SHADOW) policy records allowed=true even when reasons identify unmet requirements.\nON_HOLD: The stored participation is ON_HOLD and no active override is projected. Do not treat it as cleared for protected work; follow the canonical hold/review flow.\nINELIGIBLE: No active override or ON_HOLD state is projected, and the current decision is missing or records allowed=false. This is a job-scoped participation result, not a hiring-quality verdict or a permanent ban.\nOVERRIDE_ACTIVE: An unrevoked, unexpired participation override exists. It takes precedence in this summary, but can be action-scoped; it is not blanket permission and does not turn identity or location into verified evidence."
          },
          "evaluatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reasonCodes": {
            "type": "array",
            "description": "CURRENT_LOCATION_ALLOWED: Current credible location evidence satisfies the job location policy.\nCURRENT_LOCATION_OUTSIDE_ALLOWED_COUNTRIES: Credible current evidence is outside the allowed countries; confidence/repetition determines review versus a confirmed mismatch. This requires OpenTrain review: contact OpenTrain support, and the worker must supply new evidence.\nCLIENT_RESTRICTED_COUNTRY: Credible current evidence places the person in a client-restricted country. Seek human review of disputed evidence; do not bypass the client restriction.\nCLIENT_RESTRICTED_REGION: Credible current evidence places the person in a client-restricted region. Seek human review of disputed evidence; do not bypass the client restriction.\nANONYMIZED_OR_AMBIGUOUS_SIGNAL: Current network/location evidence is anonymized or ambiguous and cannot establish allowed physical presence. Ask the worker to sign in to the OpenTrain app from their current location without a VPN or proxy. Under a non-enforced policy the status stays ELIGIBLE and this code is diagnostic; the decision re-evaluates on the next signal from the worker once hired, or at the next job action while still recruiting. Under an enforced policy this decision has already opened a location hold that a new signal does not clear on its own, so contact OpenTrain support for review once the worker has signed in.\nCONFLICTING_CURRENT_SIGNALS: Credible current signals disagree on country alongside an outside-allowed-country signal. This requires OpenTrain review: contact OpenTrain support, and the worker must supply new evidence.\nINSUFFICIENT_CURRENT_EVIDENCE: There is not enough usable current evidence to establish location. Ask the worker to sign in to the OpenTrain app from their current location. Under a non-enforced policy the status stays ELIGIBLE and this code is diagnostic; the decision re-evaluates on the next signal from the worker once hired, or at the next job action while still recruiting. Under an enforced policy this decision has already opened a location hold that a new signal does not clear on its own, so contact OpenTrain support for review once the worker has signed in.\nSTALE_LOCATION_EVIDENCE: Recorded location observations are no longer usable as current evidence. Ask the worker to sign in to the OpenTrain app from their current location. Under a non-enforced policy the status stays ELIGIBLE and this code is diagnostic; the decision re-evaluates on the next signal from the worker once hired, or at the next job action while still recruiting. Under an enforced policy this decision has already opened a location hold that a new signal does not clear on its own, so contact OpenTrain support for review once the worker has signed in.\nACTIVE_HOLD_REQUIRES_REVIEW: An existing location hold needs explicit review/challenge; a later passive signal alone does not clear it.\nPROVIDER_EVIDENCE_UNAVAILABLE: Current provider evidence is unavailable; independent usable evidence has not established location. Wait for provider recovery or seek human review; do not treat an outage as clearance.\nFULL_ID_REQUIRED: Full identity is required by the job policy but has not been verified or requested. Request full identity verification from the proposal in the OpenTrain app; the worker then completes it. No public API or MCP operation can request it.\nFULL_ID_IN_PROGRESS: Required full identity verification is requested or in progress; it is not yet verified. Wait for the pending verification result.\nFULL_ID_FAILED: Required full identity verification failed. Seek human review before any permitted retry; do not infer clearance.\nFULL_ID_EXPIRED: Required full identity verification has expired. Re-request full identity verification.\nFULL_ID_NEEDS_REVIEW: Required full identity needs review, including a provider-approved record whose full-identity evidence is incomplete. Provider approval alone is not sufficient. Seek human identity review.\nSCOPE_NOT_FOUND: The requested job/contract/proposal participation scope could not be resolved. Scope-resolution error only; not emitted in this CandidateProjectEligibility read.\nSCOPE_MISMATCH: The supplied scope identifiers do not resolve to the same job/participation context. Scope-resolution error only; not emitted in this CandidateProjectEligibility read.\nSCOPE_USER_MISMATCH: The supplied person does not match the resolved participation scope. Scope-resolution error only; not emitted in this CandidateProjectEligibility read.\nDECISION_MISSING: The participation has no current eligibility decision; this is not evidence of clearance.\nDECISION_STALE: The decision is stale for the current policy/evidence or time window and needs reevaluation. Access-guard code only; not emitted in this CandidateProjectEligibility read. Use evaluatedAt as the freshness signal.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CandidateIdentityAssurance": {
        "type": "object",
        "description": "Privacy-safe decomposition of what the identity verdict established (DEV-2923), derived from the SAME canonical record selection as the verdict. The name match is only ever an enum — no names cross the wire. Legacy-only verdicts without a strict canonical assurance snapshot map every component to UNAVAILABLE with a null capture instant.",
        "additionalProperties": false,
        "required": [
          "components",
          "capturedAt",
          "source"
        ],
        "properties": {
          "components": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "documentAuthenticity",
              "liveness",
              "documentHolderFaceMatch",
              "nameMatch"
            ],
            "properties": {
              "documentAuthenticity": {
                "$ref": "#/components/schemas/CandidateIdentityAssuranceComponentStatus"
              },
              "liveness": {
                "$ref": "#/components/schemas/CandidateIdentityAssuranceComponentStatus"
              },
              "documentHolderFaceMatch": {
                "$ref": "#/components/schemas/CandidateIdentityAssuranceComponentStatus"
              },
              "nameMatch": {
                "$ref": "#/components/schemas/CandidateIdentityAssuranceComponentStatus"
              }
            }
          },
          "capturedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "enum": [
              "CANONICAL_ASSURANCE_SNAPSHOT",
              "LEGACY_STRIPE",
              "UNAVAILABLE"
            ]
          }
        }
      },
      "CandidateIdentityAssuranceComponentStatus": {
        "type": "string",
        "enum": [
          "PASSED",
          "FAILED",
          "PENDING",
          "NEEDS_REVIEW",
          "UNAVAILABLE",
          "NOT_RUN"
        ]
      },
      "CandidateDossierCurrentLocationDetail": {
        "type": [
          "object",
          "null"
        ],
        "description": "Dossier-only current-location decision detail (DEV-2923 B2): the SAME canonical eligibility decision the shared summary reflects, plus categorical decision facts. decisionId/decisionValidUntil are the decision’s own identity/bound, distinct from the participation-level validUntil. decisiveNetworkClassifications are the categorical classifications of exactly the decision-cited evidence — never coordinates, IP data, ASN, or timezone.",
        "additionalProperties": false,
        "required": [
          "status",
          "evaluatedAt",
          "validUntil",
          "reasonCodes",
          "latestCountryCode",
          "holdAction",
          "engineVersion",
          "decisionId",
          "decisionValidUntil",
          "decisiveEvidenceIds",
          "decisiveEvidenceTruncated",
          "decisiveNetworkClassifications"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ELIGIBLE",
              "MISMATCH",
              "INSUFFICIENT_EVIDENCE",
              "REVIEW_REQUIRED"
            ]
          },
          "evaluatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "validUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reasonCodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "latestCountryCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "holdAction": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "NONE",
              "PROVISIONAL_HOLD",
              "CONFIRMED_HOLD",
              null
            ]
          },
          "engineVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "decisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "decisionValidUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "decisiveEvidenceIds": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            }
          },
          "decisiveEvidenceTruncated": {
            "type": "boolean"
          },
          "decisiveNetworkClassifications": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "DIRECT",
                "VPN",
                "PROXY",
                "TOR",
                "RELAY",
                "DATACENTER",
                "UNKNOWN"
              ]
            }
          }
        }
      },
      "CandidateDossierEngagement": {
        "type": "object",
        "description": "Factual engagement disposition (DEV-2923 B2/B3). scope is the machine-readable count basis: EMPLOYER_CANDIDATE for employer/delegate viewers (access-union anchored); CURRENT_PROPOSAL_JOB for a candidate self-read (deliberately narrowed to the current proposal’s job). teamDisposition carries exactly two booleans — never production/backup classification.",
        "additionalProperties": false,
        "required": [
          "disposition",
          "scope",
          "contracts",
          "teamDisposition"
        ],
        "properties": {
          "disposition": {
            "type": "string",
            "enum": [
              "PROPOSAL_ONLY",
              "HISTORICAL_HIRED",
              "ACTIVE_CONTRACT",
              "ENDED_CONTRACT",
              "MULTIPLE_CONTRACTS"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "EMPLOYER_CANDIDATE",
              "CURRENT_PROPOSAL_JOB"
            ]
          },
          "contracts": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "total",
              "active",
              "ended"
            ],
            "properties": {
              "total": {
                "type": "integer"
              },
              "active": {
                "type": "integer"
              },
              "ended": {
                "type": "integer"
              }
            }
          },
          "teamDisposition": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "onActiveTeam",
              "hiredOnThisJob"
            ],
            "properties": {
              "onActiveTeam": {
                "type": "boolean"
              },
              "hiredOnThisJob": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "CandidateDossierLinks": {
        "type": "object",
        "description": "Neutral candidate link metadata (DEV-2923 B2; resume pointer DEV-2977 B3.5). Legacy external resume references are REDACTED, never passed through. LinkedIn uses the one canonical profile normalizer. No email — work or personal — ever rides here.",
        "additionalProperties": false,
        "required": [
          "linkedin",
          "resume"
        ],
        "properties": {
          "linkedin": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "url",
              "missingReason"
            ],
            "properties": {
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "missingReason": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "NOT_PROVIDED",
                  "MALFORMED",
                  null
                ]
              }
            }
          },
          "resume": {
            "description": "DEV-2977 B3.5 (F-D-2977-020): an EXACT three-state machine — the public contract cannot accept AVAILABLE with a null url or MISSING with a pointer. AVAILABLE carries the STABLE viewer-independent same-origin audited access path (/api/public/v1/proposals/{proposalId}/dossier/resume?mode=redirect) — never a signed storage URL — with a null dossier-level expiry (the stable pointer does not expire; the resume operation returns the signed-URL expiry). Byte-identical for every authorized dossier viewer; FOLLOWING it requires canonical-admin (OpenTrain staff) authority plus BOTH candidate_dossier:read AND candidate_documents:read — resume FILES are admin-only: employers and their agents receive a typed RESUME_FILES_ADMIN_ONLY 403, candidate self a typed SELF_ACCESS_NOT_SUPPORTED denial.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "availability",
                  "url",
                  "expiresAt",
                  "reason"
                ],
                "properties": {
                  "availability": {
                    "type": "string",
                    "enum": [
                      "AVAILABLE"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "description": "The stable relative same-origin audited access path for this proposal."
                  },
                  "expiresAt": {
                    "type": "null"
                  },
                  "reason": {
                    "type": "null"
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "availability",
                  "url",
                  "expiresAt",
                  "reason"
                ],
                "properties": {
                  "availability": {
                    "type": "string",
                    "enum": [
                      "MISSING"
                    ]
                  },
                  "url": {
                    "type": "null"
                  },
                  "expiresAt": {
                    "type": "null"
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "NOT_PROVIDED"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "availability",
                  "url",
                  "expiresAt",
                  "reason"
                ],
                "properties": {
                  "availability": {
                    "type": "string",
                    "enum": [
                      "LEGACY_EXTERNAL_REFERENCE_REDACTED"
                    ]
                  },
                  "url": {
                    "type": "null"
                  },
                  "expiresAt": {
                    "type": "null"
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "EXTERNAL_REFERENCE_REDACTED"
                    ]
                  }
                }
              }
            ]
          }
        }
      },
      "CandidateDossierEvidenceContinuation": {
        "description": "One continuation rule for every evidence family: COMPLETE when not truncated; OPERATION with the exact pageable operation id + last-item cursor when truncated and such an operation exists; BOUNDED_SNAPSHOT_ONLY when truncated with no pageable operation (the cap is the contract).",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "operationId",
              "cursor"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "OPERATION"
                ]
              },
              "operationId": {
                "type": "string",
                "enum": [
                  "candidate_dossier.reviews.list",
                  "candidate_dossier.contract_history.list"
                ]
              },
              "cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "BOUNDED_SNAPSHOT_ONLY"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "COMPLETE"
                ]
              }
            }
          }
        ]
      },
      "CandidateDossierEvidence": {
        "type": [
          "object",
          "null"
        ],
        "description": "Bounded metadata-only full-evidence block (DEV-2923 B3); null in CONCISE mode. Ten families, each capped at 25 items with truthful truncation and typed continuation. Metadata only: no message bodies or participant identities, provider/session references, assessment runtime internals, compensation amounts, coordinates/IP/ASN/timezone data, or raw documents — ever.",
        "additionalProperties": false,
        "required": [
          "identityVerificationHistory",
          "identityRequests",
          "eligibilityDecisionHistory",
          "locationObservations",
          "employerProposalHistory",
          "employerContractFacts",
          "contractHistoryPreview",
          "workAssessmentAttempts",
          "curatedReviews",
          "proposalConversationActivity"
        ],
        "properties": {
          "identityVerificationHistory": {
            "type": "object",
            "description": "Canonical identity verification records (all providers, incl. superseded).",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierIdentityRecordEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "identityRequests": {
            "type": "object",
            "description": "Identity request metadata scoped to this person/current job/current proposal.",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierIdentityRequestEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "eligibilityDecisionHistory": {
            "type": "object",
            "description": "Append-only eligibility decision chain for the current participation.",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierEligibilityDecisionEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "locationObservations": {
            "type": "object",
            "description": "Timestamped categorical location observations (person + current-job scope).",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierLocationObservationEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "employerProposalHistory": {
            "type": "object",
            "description": "This employer’s proposals to the candidate (accessible-job scope; candidate self-reads contain only the current proposal). Never bid amounts.",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierProposalEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "employerContractFacts": {
            "type": "object",
            "description": "This employer’s contracts with the candidate (viewer-context anchor). Never compensation.",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierEmployerContractEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "contractHistoryPreview": {
            "type": "object",
            "description": "First bounded page of the cross-buyer contract history; continue via candidate_dossier.contract_history.list.",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierContractHistoryEvidenceItem"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "workAssessmentAttempts": {
            "type": "object",
            "description": "Work-assessment attempts for exactly this proposal (metadata + canonical scalar score only).",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierAssessmentAttemptEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "curatedReviews": {
            "type": "object",
            "description": "First page of the curated review set (metadata only — commentPresent, never the body); continue via candidate_dossier.reviews.list.",
            "additionalProperties": false,
            "required": [
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierReviewEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          },
          "proposalConversationActivity": {
            "type": "object",
            "description": "Proposal-DM activity metadata resolved ONLY through the proposal’s own conversation pointer. availability distinguishes a missing pointer (MISSING) from a corrupt one (INVALID_REFERENCE) without leaking ids; message content and participant identities never appear.",
            "additionalProperties": false,
            "required": [
              "availability",
              "lastActivityAt",
              "items",
              "totalCount",
              "truncated",
              "continuation"
            ],
            "properties": {
              "availability": {
                "type": "string",
                "enum": [
                  "AVAILABLE",
                  "MISSING",
                  "INVALID_REFERENCE"
                ]
              },
              "lastActivityAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Null unless availability is AVAILABLE."
              },
              "items": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/CandidateDossierConversationMessageEvidence"
                }
              },
              "totalCount": {
                "type": "integer"
              },
              "truncated": {
                "type": "boolean"
              },
              "continuation": {
                "$ref": "#/components/schemas/CandidateDossierEvidenceContinuation"
              }
            }
          }
        }
      },
      "CandidateDossierIdentityRecordEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outcome",
          "provider",
          "method",
          "assuranceLevel",
          "disposition",
          "supersededAt",
          "manualReview",
          "createdAt",
          "decidedAt",
          "verifiedAt",
          "expiresAt",
          "identityCountryCode"
        ],
        "properties": {
          "outcome": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PENDING",
              "APPROVED",
              "REJECTED",
              "EXPIRED",
              "CANCELED",
              null
            ],
            "description": "Documented stored record status — NOT the reconciled current verdict, which stays the sole authoritative answer."
          },
          "provider": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "DIDIT",
              "STRIPE_IDENTITY",
              null
            ]
          },
          "method": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "DOCUMENT",
              "DOCUMENT_BIOMETRIC",
              "MANUAL_REVIEW",
              null
            ]
          },
          "assuranceLevel": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PROVIDER_CONFIRMED",
              "SIGNED_CALLBACK_PENDING_ENRICHMENT",
              "UNCONFIRMED_LEGACY",
              "LEGACY_STRIPE_APPROVED",
              null
            ]
          },
          "disposition": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "SUPERSEDED",
              "UNKNOWN"
            ]
          },
          "supersededAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "manualReview": {
            "type": "boolean",
            "description": "Derives ONLY from method MANUAL_REVIEW."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "decidedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "identityCountryCode": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CandidateDossierIdentityRequestEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason",
          "status",
          "createdAt",
          "requestedAt",
          "completedAt",
          "canceledAt",
          "providerReviewRequired"
        ],
        "properties": {
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "JOB_REQUIREMENT",
              "MANUAL_EMPLOYER",
              "MANUAL_ADMIN",
              "ONBOARDING",
              "ACCOUNT",
              "LOCATION_RISK",
              "TRUST_POLICY",
              "RECHECK",
              null
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "REQUIRED_NOT_REQUESTED",
              "REQUESTED",
              "IN_PROGRESS",
              "VERIFIED",
              "FAILED",
              "EXPIRED",
              "NEEDS_REVIEW",
              "CANCELED",
              null
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "requestedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "providerReviewRequired": {
            "type": "boolean"
          }
        }
      },
      "CandidateDossierEligibilityDecisionEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "decisionId",
          "allowed",
          "holdAction",
          "latestCountryCode",
          "reasonCodes",
          "evaluatedAt",
          "validUntil",
          "engineVersion",
          "overrideApplied",
          "supersedesPrevious"
        ],
        "properties": {
          "decisionId": {
            "type": "string"
          },
          "allowed": {
            "type": "boolean"
          },
          "holdAction": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "NONE",
              "PROVISIONAL_HOLD",
              "CONFIRMED_HOLD",
              null
            ]
          },
          "latestCountryCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "reasonCodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "evaluatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "validUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "engineVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "overrideApplied": {
            "type": "boolean"
          },
          "supersedesPrevious": {
            "type": "boolean"
          }
        }
      },
      "CandidateDossierLocationObservationEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "countryCode",
          "observedAt",
          "expiresAt",
          "confidence",
          "networkClassification"
        ],
        "properties": {
          "source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "IP",
              "GPS",
              "DEVICE",
              null
            ]
          },
          "countryCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "confidence": {
            "type": "string",
            "enum": [
              "HIGH",
              "MEDIUM",
              "LOW",
              "UNKNOWN"
            ]
          },
          "networkClassification": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "DIRECT",
              "VPN",
              "PROXY",
              "TOR",
              "RELAY",
              "DATACENTER",
              "UNKNOWN",
              null
            ]
          }
        }
      },
      "CandidateDossierProposalEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "proposalId",
          "jobId",
          "jobTitle",
          "status",
          "createdAt",
          "updatedAt",
          "aiInterviewLinked",
          "locationVerificationStatus"
        ],
        "properties": {
          "proposalId": {
            "type": "string"
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "raw",
              "label"
            ],
            "properties": {
              "raw": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "UNREVIEWED",
                  "SHORTLISTED",
                  "MAYBE",
                  "HIRED",
                  "DECLINED",
                  "NOT_A_FIT",
                  "RESUME_SENT",
                  "ACTIVE",
                  null
                ]
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "Unreviewed",
                  "Shortlisted",
                  "Maybe",
                  "Hired",
                  "Declined",
                  "Resume Sent",
                  "Active",
                  null
                ]
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "aiInterviewLinked": {
            "type": "boolean"
          },
          "locationVerificationStatus": {
            "type": "string",
            "enum": [
              "PASSED",
              "FAILED",
              "NOT_RECORDED"
            ]
          }
        }
      },
      "CandidateDossierEmployerContractEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contractId",
          "jobId",
          "jobTitle",
          "status",
          "startedAt",
          "endedAt",
          "reviewed"
        ],
        "properties": {
          "contractId": {
            "type": "string"
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ENDED"
            ]
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "endedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reviewed": {
            "type": "boolean"
          }
        }
      },
      "CandidateDossierResumeProvenance": {
        "type": "object",
        "description": "Provenance of the exact stored resume object OBSERVED at link issuance from the storage bucket that signed the URL. An observation, not a binding: nothing here proves the bytes a later download returns. `checksum` is reserved for an authoritative SHA-256 digest and is null today; `storageEtag` is the provider’s opaque validator preserved verbatim (quotes/weak syntax included) and is NOT a checksum. `fileName` is the sanitized original upload name recovered from the recognized object-name formats only. Never storage paths, bucket names, object versions, or candidate contact data.",
        "additionalProperties": false,
        "required": [
          "proposalId",
          "candidateUserId",
          "fileName",
          "contentType",
          "sizeBytes",
          "uploadedAt",
          "lastModifiedAt",
          "observedAt",
          "checksum",
          "storageEtag"
        ],
        "properties": {
          "proposalId": {
            "type": "string"
          },
          "candidateUserId": {
            "type": "string"
          },
          "fileName": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 180
          },
          "contentType": {
            "type": [
              "string",
              "null"
            ],
            "description": "Allowlisted resume MIME type as recorded by storage; null when unrecognized."
          },
          "sizeBytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "uploadedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastModifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "checksum": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "algorithm",
                  "value"
                ],
                "properties": {
                  "algorithm": {
                    "type": "string",
                    "enum": [
                      "SHA256"
                    ]
                  },
                  "value": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "storageEtag": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 128
          }
        }
      },
      "PublicApiJobInvitationItem": {
        "type": "object",
        "description": "One INVITE row for an employer-owned job. State derives from canonical Joboffer rows. DEV-3285: inviting again after the 30 days on an open job creates a new invitation, and the invitation it replaced reads EXPIRED from then on, whatever else is true of it, with `linkedProposalId` null. Any other invitation reads HIRED > APPLIED > DECLINED > EXPIRED > INVITED, where EXPIRED means the job closed or `expiresAt` (30 days after sending) passed. Identity is masked: first name + last initial, slug, and country only — never contact details, resume content, or verification payloads.",
        "additionalProperties": false,
        "required": [
          "id",
          "jobId",
          "freelancerId",
          "candidate",
          "invitedAt",
          "updatedAt",
          "expiresAt",
          "state",
          "hireAcceptancePending",
          "linkedProposalId"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable invitation (Joboffer INVITE row) id."
          },
          "jobId": {
            "type": "string"
          },
          "freelancerId": {
            "type": "string"
          },
          "candidate": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "displayName",
              "profileSlug",
              "countryCode"
            ],
            "properties": {
              "displayName": {
                "type": "string",
                "description": "Masked first name + last initial."
              },
              "profileSlug": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "countryCode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "invitedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "DEV-3285: 30 days after `invitedAt`. The invitation reads EXPIRED after this instant, or earlier once the job closes or a newer invitation replaces it."
          },
          "state": {
            "type": "string",
            "enum": [
              "INVITED",
              "DECLINED",
              "APPLIED",
              "HIRED",
              "EXPIRED"
            ]
          },
          "hireAcceptancePending": {
            "type": "boolean",
            "description": "True only while a REAL live hire authorization exists that the candidate has not accepted (stored intent, present future expiry, not canceled, not captured)."
          },
          "linkedProposalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The candidate's PROPOSAL row for this job when one exists. Always null on an invitation a newer one replaced (DEV-3285): the proposal links to the current invitation only."
          }
        }
      },
      "CandidateDossierApplicationItem": {
        "type": "object",
        "description": "One canonical Joboffer row for the candidate: PROPOSAL (candidate-submitted) or INVITE (employer-created), never conflated. Bid amounts carry rate-integrity status; outcome flags are the raw canonical booleans; the resulting contract is ONLY an exact offer-linked contract.",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "jobId",
          "jobTitle",
          "jobCategory",
          "organizationId",
          "status",
          "outcome",
          "bid",
          "createdAt",
          "updatedAt",
          "contract"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "PROPOSAL",
              "INVITE"
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobCategory": {
            "type": [
              "string",
              "null"
            ]
          },
          "organizationId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Resolved through the canonical job→organization resolver; null when unresolvable."
          },
          "status": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "raw",
              "label"
            ],
            "properties": {
              "raw": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "outcome": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "candidateAccepted",
              "declined"
            ],
            "properties": {
              "candidateAccepted": {
                "type": "boolean"
              },
              "declined": {
                "type": "boolean"
              }
            }
          },
          "bid": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "amountUsd",
              "unit",
              "amountStatus"
            ],
            "properties": {
              "amountUsd": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "unit": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "per_hour",
                  "fixed_price",
                  "per_label",
                  null
                ]
              },
              "amountStatus": {
                "type": "string",
                "enum": [
                  "VALID",
                  "MISSING",
                  "INVALID_RATE_DATA"
                ]
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "contract": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "resulted",
              "contractId",
              "status"
            ],
            "properties": {
              "resulted": {
                "type": "boolean"
              },
              "contractId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "ACTIVE",
                  "ENDED",
                  null
                ]
              }
            }
          }
        }
      },
      "CandidateDossierContractHistoryEvidenceItem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "jobTitle",
          "status",
          "startedAt",
          "endedAt",
          "reviewed"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ENDED"
            ]
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reviewed": {
            "type": "boolean"
          }
        }
      },
      "CandidateDossierAssessmentAttemptEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "attemptStatus",
          "reviewStatus",
          "score",
          "latestRating",
          "latestReviewedAt",
          "createdAt",
          "startedAt",
          "completedAt",
          "deadlineAt",
          "stale",
          "retakeRequired"
        ],
        "properties": {
          "attemptStatus": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "NOT_STARTED",
              "IN_PROGRESS",
              "COMPLETED",
              null
            ]
          },
          "reviewStatus": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PENDING",
              "AUTO_SCORED",
              "REVIEWED",
              null
            ]
          },
          "score": {
            "type": [
              "number",
              "null"
            ]
          },
          "latestRating": {
            "type": [
              "number",
              "null"
            ]
          },
          "latestReviewedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deadlineAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "stale": {
            "type": "boolean"
          },
          "retakeRequired": {
            "type": "boolean"
          }
        }
      },
      "CandidateDossierReviewEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "rating",
          "categories",
          "createdAt",
          "commentPresent"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "rating": {
            "type": [
              "number",
              "null"
            ]
          },
          "categories": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "labelQuality",
              "communication",
              "speed",
              "software",
              "instructionFollowing"
            ],
            "properties": {
              "labelQuality": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "communication": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "speed": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "software": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "instructionFollowing": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "commentPresent": {
            "type": "boolean",
            "description": "Metadata only — the comment body never rides in evidence."
          }
        }
      },
      "CandidateDossierConversationMessageEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sentAt",
          "messageType",
          "hasAttachments",
          "edited"
        ],
        "properties": {
          "sentAt": {
            "type": "string",
            "format": "date-time"
          },
          "messageType": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PROPOSAL",
              "PAYOUT_REQUEST",
              "MILESTONE_APPROVED_PAYOUT_PENDING",
              "MILESTONE_APPROVED_PAYOUT_SENT",
              "MILESTONE_ACTIVATED_FUNDED",
              "COMPENSATION_CHANGE",
              "VERIFICATION",
              null
            ]
          },
          "hasAttachments": {
            "type": "boolean"
          },
          "edited": {
            "type": "boolean"
          }
        }
      },
      "PublicApiContractMilestoneRecord": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "description",
          "status",
          "amountUsd",
          "volume",
          "milestoneNumber",
          "dueDate",
          "pendingApproval",
          "needsReview",
          "invoiceId",
          "payoutState",
          "payoutQueued",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "amountUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "volume": {
            "type": [
              "number",
              "null"
            ]
          },
          "milestoneNumber": {
            "type": [
              "number",
              "null"
            ]
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "pendingApproval": {
            "type": "boolean"
          },
          "needsReview": {
            "type": "boolean"
          },
          "invoiceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "payoutState": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "waiting_for_connect",
              "waiting_for_funds",
              "retry_scheduled",
              "processing",
              "transferred",
              "manual_review",
              null
            ]
          },
          "payoutQueued": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Optimistic-concurrency revision required by milestone edits."
          }
        }
      },
      "PublicApiContractFreelancer": {
        "type": "object",
        "description": "Post-hire freelancer identity. displayName is masked to \"First L.\"; personal contact details are never returned.",
        "additionalProperties": false,
        "required": [
          "userId",
          "displayName",
          "country",
          "profilePath"
        ],
        "properties": {
          "userId": {
            "type": [
              "string",
              "null"
            ]
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "profilePath": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicApiContractRecord": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "participationState",
          "settlementState",
          "title",
          "jobId",
          "proposalId",
          "paymentType",
          "rateUsd",
          "estimatedTotalUsd",
          "estimatedVolume",
          "hasActiveMilestone",
          "startDate",
          "endDate",
          "createdAt",
          "updatedAt",
          "freelancer",
          "milestones"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "ended"
            ]
          },
          "participationState": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "OFFBOARDING",
              "OFFBOARDED_PAYABLE",
              "CLOSED",
              "REACTIVATED"
            ]
          },
          "settlementState": {
            "type": "string",
            "enum": [
              "ACTION_REQUIRED",
              "PROCESSING",
              "SETTLED"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "dashboardUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Canonical absolute employer dashboard deep link for this contract. Emitted when X-OpenTrain-Features includes contract-dashboard-url-v1; legacy responses may omit it."
          },
          "paymentType": {
            "type": [
              "string",
              "null"
            ]
          },
          "rateUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "estimatedTotalUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "estimatedVolume": {
            "type": [
              "number",
              "null"
            ]
          },
          "hasActiveMilestone": {
            "type": "boolean"
          },
          "startDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "freelancer": {
            "$ref": "#/components/schemas/PublicApiContractFreelancer"
          },
          "milestones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiContractMilestoneRecord"
            }
          }
        }
      },
      "PublicApiContractListResponse": {
        "type": "object",
        "description": "One bounded page of contracts with independent participation and settlement states. `asOf` is the stable creation cutoff carried by every cursor in one walk. `nextCursor` is bound to every original filter; `totalCount`, `hasMore`, `collectedCount`, and `complete` are truthful page metadata. `pageSize` is null only for the unchanged unpaged job-scoped read.",
        "additionalProperties": false,
        "required": [
          "contracts",
          "asOf",
          "nextCursor",
          "totalCount",
          "pageSize",
          "hasMore",
          "collectedCount",
          "complete"
        ],
        "properties": {
          "contracts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiContractRecord"
            }
          },
          "asOf": {
            "type": "string",
            "format": "date-time"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "totalCount": {
            "type": "integer",
            "minimum": 0
          },
          "pageSize": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100
          },
          "hasMore": {
            "type": "boolean"
          },
          "collectedCount": {
            "type": "integer",
            "minimum": 0
          },
          "complete": {
            "type": "boolean"
          }
        }
      },
      "ContractHistoryWarning": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message",
          "contractId",
          "proposalId"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "HIRED_WITHOUT_ACTIVE_CONTRACT",
              "ACTIVE_CONTRACT_WITHOUT_HIRED_PROPOSAL",
              "MULTIPLE_ACTIVE_CONTRACTS",
              "PROPOSAL_LINEAGE_MISSING",
              "PROPOSAL_LINEAGE_MISMATCH",
              "LINEAGE_INFERRED_BY_JOB_WORKER",
              "LEGACY_END_STATE_DISAGREEMENT",
              "PURPOSE_EVIDENCE_INCOMPLETE",
              "PURPOSE_EVIDENCE_CONFLICT",
              "CONTRACTS_TRUNCATED",
              "MILESTONES_TRUNCATED",
              "TIMELINE_TRUNCATED"
            ]
          },
          "message": {
            "type": "string"
          },
          "contractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ContractHistoryPurposeEvidence": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "projectId",
          "assignmentId",
          "purposeText",
          "observedAt"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "WORK_PROJECT_PURPOSE"
            ]
          },
          "projectId": {
            "type": "string"
          },
          "assignmentId": {
            "type": "string"
          },
          "purposeText": {
            "type": [
              "string",
              "null"
            ],
            "description": "Raw stored WorkProject.purposeText (SCREENING | PRODUCTION | other | null)."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ContractHistoryPurpose": {
        "type": "object",
        "description": "Purpose from contract-linked work-project evidence ONLY. EVIDENCE = every observation agrees; NO_EVIDENCE = no observation carries a known purpose; INCOMPLETE_EVIDENCE = a known purpose coexists with null/unknown observations, or the per-contract evidence cap (50) was hit — a partial set never classifies; CONFLICTING_EVIDENCE = SCREENING and PRODUCTION both observed. The last two stay UNSPECIFIED and raise a typed warning. Titles, milestone names, proposal labels, and rehire audits are never purpose evidence.",
        "additionalProperties": false,
        "required": [
          "value",
          "reason",
          "evidence",
          "evidenceTruncated"
        ],
        "properties": {
          "value": {
            "type": "string",
            "enum": [
              "ASSESSMENT",
              "PRODUCTION",
              "UNSPECIFIED"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "EVIDENCE",
              "NO_EVIDENCE",
              "INCOMPLETE_EVIDENCE",
              "CONFLICTING_EVIDENCE"
            ]
          },
          "evidence": {
            "type": "array",
            "description": "The bounded observations — at most 50 per contract, oldest first.",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/ContractHistoryPurposeEvidence"
            }
          },
          "evidenceTruncated": {
            "type": "boolean",
            "description": "True when the contract has more observations than the cap; the value is then UNSPECIFIED / INCOMPLETE_EVIDENCE."
          }
        }
      },
      "ContractHistoryRehire": {
        "type": "object",
        "description": "Audit-backed ONLY: populated from admin_balance.rehire_created rows whose prior and successor contracts both belong to this lineage; otherwise null / [] with source null. A chronological predecessor is never called a rehire.",
        "additionalProperties": false,
        "required": [
          "priorContractId",
          "successorContractIds",
          "source"
        ],
        "properties": {
          "priorContractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "successorContractIds": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string"
            }
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "ADMIN_AUDIT_LOG",
              null
            ]
          }
        }
      },
      "ContractHistoryProposal": {
        "type": "object",
        "description": "The proposal’s CURRENT row. `currentStatus` is observed at `asOf`; it is not a transition and never appears in the chronology. `hired` is a label, never a grant of access.",
        "additionalProperties": false,
        "required": [
          "id",
          "jobId",
          "createdAt",
          "updatedAt",
          "currentStatus",
          "hired",
          "candidateUserId"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "currentStatus": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "raw",
              "label",
              "observedAt"
            ],
            "properties": {
              "raw": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "observedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "hired": {
            "type": "boolean"
          },
          "candidateUserId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ContractHistoryContract": {
        "type": "object",
        "description": "The canonical PublicApiContractRecord (same serializer, milestone visibility, and payout state as /contracts) plus lifecycle, audit-backed rehire, and evidence-only purpose facts.",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "participationState",
          "settlementState",
          "title",
          "jobId",
          "proposalId",
          "paymentType",
          "rateUsd",
          "estimatedTotalUsd",
          "estimatedVolume",
          "hasActiveMilestone",
          "startDate",
          "endDate",
          "createdAt",
          "updatedAt",
          "freelancer",
          "milestones",
          "endLifecycleState",
          "reactivatedAt",
          "currentAccess",
          "rehire",
          "purpose"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "ended"
            ]
          },
          "participationState": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "OFFBOARDING",
              "OFFBOARDED_PAYABLE",
              "CLOSED",
              "REACTIVATED"
            ]
          },
          "settlementState": {
            "type": "string",
            "enum": [
              "ACTION_REQUIRED",
              "PROCESSING",
              "SETTLED"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "dashboardUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Canonical absolute employer dashboard deep link for this contract. Emitted when X-OpenTrain-Features includes contract-dashboard-url-v1; legacy responses may omit it."
          },
          "paymentType": {
            "type": [
              "string",
              "null"
            ]
          },
          "rateUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "estimatedTotalUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "estimatedVolume": {
            "type": [
              "number",
              "null"
            ]
          },
          "hasActiveMilestone": {
            "type": "boolean"
          },
          "startDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "endDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "freelancer": {
            "$ref": "#/components/schemas/PublicApiContractFreelancer"
          },
          "milestones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiContractMilestoneRecord"
            },
            "maxItems": 200,
            "description": "Visible milestones of this contract, bounded to 200 on the history read."
          },
          "endLifecycleState": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "ACTIVE",
              "END_REQUESTED",
              "OFFBOARDING",
              "ENDED",
              null
            ],
            "description": "Stored contract-end lifecycle state; null only for absent or unrecognized legacy data."
          },
          "reactivatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "currentAccess": {
            "type": "boolean",
            "description": "True when participationState is ACTIVE or REACTIVATED."
          },
          "rehire": {
            "$ref": "#/components/schemas/ContractHistoryRehire"
          },
          "purpose": {
            "$ref": "#/components/schemas/ContractHistoryPurpose"
          }
        }
      },
      "ContractHistoryTimelineEntry": {
        "description": "Durable stored timestamps only: PROPOSAL_SUBMITTED < CONTRACT_CREATED < REHIRE_CREATED < CONTRACT_STARTED < MILESTONE_CREATED < CONTRACT_REACTIVATED < CONTRACT_ENDED at equal instants. Entries whose source timestamp is null are omitted, never dated.",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "at",
              "proposalId"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "PROPOSAL_SUBMITTED"
                ]
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "Joboffer.createdAt"
              },
              "proposalId": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "at",
              "contractId",
              "rehireOfContractId"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CONTRACT_CREATED"
                ]
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "Contract.createdAt"
              },
              "contractId": {
                "type": "string"
              },
              "rehireOfContractId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Set ONLY when an admin_balance.rehire_created audit row names this contract as the successor."
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "at",
              "priorContractId",
              "contractId",
              "source"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "REHIRE_CREATED"
                ]
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "AdminAuditLog.createdAt"
              },
              "priorContractId": {
                "type": "string"
              },
              "contractId": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "enum": [
                  "ADMIN_AUDIT_LOG"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "at",
              "contractId"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CONTRACT_STARTED"
                ]
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "Contract.contractStartDateDate"
              },
              "contractId": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "at",
              "contractId",
              "milestoneId",
              "snapshot"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MILESTONE_CREATED"
                ]
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "Milestone.createdAt"
              },
              "contractId": {
                "type": "string"
              },
              "milestoneId": {
                "type": "string"
              },
              "snapshot": {
                "description": "The milestone’s CURRENT canonical snapshot — not a status transition.",
                "$ref": "#/components/schemas/PublicApiContractMilestoneRecord"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "at",
              "contractId"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CONTRACT_REACTIVATED"
                ]
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "Contract.reactivatedAt"
              },
              "contractId": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "at",
              "contractId",
              "participationState",
              "endLifecycleState"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CONTRACT_ENDED"
                ]
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "Contract.endDateDate"
              },
              "contractId": {
                "type": "string"
              },
              "participationState": {
                "type": "string",
                "enum": [
                  "ACTIVE",
                  "OFFBOARDING",
                  "OFFBOARDED_PAYABLE",
                  "CLOSED",
                  "REACTIVATED"
                ]
              },
              "endLifecycleState": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "ACTIVE",
                  "END_REQUESTED",
                  "OFFBOARDING",
                  "ENDED",
                  null
                ],
                "description": "Stored contract-end lifecycle state; null only for absent or unrecognized legacy data."
              }
            }
          }
        ]
      },
      "ContractHistoryGetResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "asOf",
          "selector",
          "view",
          "lineage",
          "current",
          "contracts",
          "timeline",
          "warnings",
          "truncated",
          "provenance"
        ],
        "properties": {
          "asOf": {
            "type": "string",
            "format": "date-time"
          },
          "selector": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "contractId"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "CONTRACT"
                    ]
                  },
                  "contractId": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "proposalId"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "PROPOSAL"
                    ]
                  },
                  "proposalId": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "view": {
            "type": "string",
            "enum": [
              "current",
              "timeline"
            ]
          },
          "lineage": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "jobId",
              "jobTitle",
              "workerUserId",
              "proposalId",
              "source",
              "contractIds"
            ],
            "properties": {
              "jobId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "jobTitle": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workerUserId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "proposalId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "PROPOSAL_LINK",
                  "JOB_WORKER_FALLBACK",
                  "NONE"
                ]
              },
              "contractIds": {
                "type": "array",
                "description": "Ordinary chronology (createdAt, id) of the bounded lineage — never a rehire claim.",
                "maxItems": 50,
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "current": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "access",
              "proposal",
              "counts"
            ],
            "properties": {
              "access": {
                "type": "object",
                "description": "Derived ONLY from participationState ACTIVE/REACTIVATED. ACTIVE = exactly one such contract; CONFLICT = more than one (all listed); NONE = none. Nothing ever picks one contract silently.",
                "additionalProperties": false,
                "required": [
                  "state",
                  "contractIds"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "NONE",
                      "CONFLICT"
                    ]
                  },
                  "contractIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "proposal": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ContractHistoryProposal"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "counts": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contracts",
                  "activeContracts",
                  "endedContracts",
                  "milestones",
                  "pendingPayouts"
                ],
                "properties": {
                  "contracts": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "activeContracts": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "endedContracts": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "milestones": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Visible milestones of the RETURNED contract records."
                  },
                  "pendingPayouts": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Unsettled payout invoices across the bounded lineage."
                  }
                }
              }
            }
          },
          "contracts": {
            "type": "array",
            "description": "view=current: every ACTIVE/REACTIVATED record (all of them under CONFLICT), otherwise the latest ended record; view=timeline: every bounded lineage record, chronological.",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/ContractHistoryContract"
            }
          },
          "timeline": {
            "type": "array",
            "description": "Empty on view=current.",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/ContractHistoryTimelineEntry"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContractHistoryWarning"
            }
          },
          "truncated": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "contracts",
              "milestones",
              "timeline",
              "purposeEvidence"
            ],
            "properties": {
              "contracts": {
                "type": "boolean"
              },
              "milestones": {
                "type": "boolean"
              },
              "timeline": {
                "type": "boolean"
              },
              "purposeEvidence": {
                "type": "boolean",
                "description": "Some returned contract hit the per-contract purpose evidence cap."
              }
            }
          },
          "provenance": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "contracts",
              "proposal",
              "rehire",
              "purpose"
            ],
            "properties": {
              "contracts": {
                "type": "string",
                "enum": [
                  "CANONICAL_CONTRACT_SERIALIZER"
                ]
              },
              "proposal": {
                "type": "string",
                "enum": [
                  "CANONICAL_JOBOFFER_ROW"
                ]
              },
              "rehire": {
                "type": "string",
                "enum": [
                  "ADMIN_AUDIT_LOG"
                ]
              },
              "purpose": {
                "type": "string",
                "enum": [
                  "WORK_PROJECT_EVIDENCE"
                ]
              }
            }
          }
        }
      },
      "LmsCourseAuthoringIntent": {
        "type": "object",
        "description": "Optional advisory authoring declaration persisted in the canonical draft and frozen into published versions. Assignment and retraining records remain delivery authority.",
        "required": [
          "schemaVersion",
          "validationIntent",
          "completionPolicy"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "validationIntent": {
            "type": "string",
            "enum": [
              "STANDARD",
              "INDIVIDUAL_MASTERY"
            ]
          },
          "completionPolicy": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "EMPLOYER_REVIEW"
            ]
          }
        }
      },
      "LmsAuthoringAcknowledgement": {
        "type": "object",
        "description": "Request-scoped acknowledgement of one acknowledgeable authoring WARNING, bound to the exact finding identity. Never persisted; a later content change makes it stale.",
        "required": [
          "code",
          "moduleKey",
          "lessonKey",
          "contentHash"
        ],
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "QUIZ_LIKE_CONTENT_WITHOUT_ASSESSMENT",
              "MANUAL_REVIEW_UNDER_MASTERY_INTENT",
              "ANSWER_POSITION_PATTERN",
              "OPERATIONAL_METADATA_IN_LEARNER_COPY",
              "OVERLONG_FIRST_CHECK"
            ]
          },
          "moduleKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "lessonKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "contentHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "LmsAuthoringFinding": {
        "type": "object",
        "description": "One deterministic authoring diagnostic. WARNING findings are acknowledgeable at publish; ERROR contradictions never are. Details carry counts/positions only — never option labels, answer values, or learner text.",
        "required": [
          "code",
          "severity",
          "acknowledgeable",
          "moduleKey",
          "lessonKey",
          "questionId",
          "message",
          "remediation",
          "contentHash",
          "acknowledgementId",
          "acknowledged",
          "details"
        ],
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "QUIZ_LIKE_CONTENT_WITHOUT_ASSESSMENT",
              "MANUAL_REVIEW_UNDER_MASTERY_INTENT",
              "ANSWER_POSITION_PATTERN",
              "OPERATIONAL_METADATA_IN_LEARNER_COPY",
              "OVERLONG_FIRST_CHECK"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "ERROR",
              "WARNING"
            ]
          },
          "acknowledgeable": {
            "type": "boolean"
          },
          "moduleKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "lessonKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "questionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "remediation": {
            "type": "string"
          },
          "contentHash": {
            "type": "string"
          },
          "acknowledgementId": {
            "type": "string",
            "description": "code:moduleKey:lessonKey:contentHash (null keys are \"~\"); echo it in publish acknowledgements."
          },
          "acknowledged": {
            "type": "boolean"
          },
          "details": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        }
      },
      "LmsAuthoringAssessmentSummary": {
        "type": "object",
        "required": [
          "moduleKey",
          "lessonKey",
          "resolved",
          "questionCount",
          "autoGradedCount",
          "manualGradedCount",
          "ungradedCount",
          "passRule",
          "passThresholdPercent",
          "passThresholdPoints",
          "attemptPolicy",
          "maxAttempts",
          "resultRelease",
          "passRequired",
          "manualReview",
          "completionMode",
          "gatesProgression"
        ],
        "additionalProperties": false,
        "properties": {
          "moduleKey": {
            "type": "string"
          },
          "lessonKey": {
            "type": "string"
          },
          "resolved": {
            "type": "boolean"
          },
          "questionCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "autoGradedCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "manualGradedCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "ungradedCount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "passRule": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "PERCENTAGE",
              "ABSOLUTE",
              "NONE",
              null
            ]
          },
          "passThresholdPercent": {
            "type": [
              "integer",
              "null"
            ]
          },
          "passThresholdPoints": {
            "type": [
              "integer",
              "null"
            ]
          },
          "attemptPolicy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "UNLIMITED",
              "LIMITED",
              null
            ]
          },
          "maxAttempts": {
            "type": [
              "integer",
              "null"
            ]
          },
          "resultRelease": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "IMMEDIATE",
              "MANUAL",
              null
            ]
          },
          "passRequired": {
            "type": "boolean"
          },
          "manualReview": {
            "type": "boolean"
          },
          "completionMode": {
            "type": [
              "string",
              "null"
            ]
          },
          "gatesProgression": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "LmsAuthoringSummary": {
        "type": "object",
        "description": "Compact authoring readback: counts, thresholds, retry/release policy where canonically available (null = unknown, never inferred), the active validation intent, and warning/error counts.",
        "required": [
          "schemaVersion",
          "validationIntent",
          "intentSource",
          "moduleCount",
          "lessons",
          "assessments",
          "findings",
          "publishBlocked",
          "blockReasons"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "validationIntent": {
            "type": "string",
            "enum": [
              "STANDARD",
              "INDIVIDUAL_MASTERY"
            ]
          },
          "intentSource": {
            "type": "string",
            "enum": [
              "REQUEST",
              "DRAFT",
              "DEFAULT"
            ]
          },
          "moduleCount": {
            "type": "integer"
          },
          "lessons": {
            "type": "object",
            "required": [
              "total",
              "content",
              "assessment",
              "required"
            ],
            "additionalProperties": false,
            "properties": {
              "total": {
                "type": "integer"
              },
              "content": {
                "type": "integer"
              },
              "assessment": {
                "type": "integer"
              },
              "required": {
                "type": "integer"
              }
            }
          },
          "assessments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsAuthoringAssessmentSummary"
            }
          },
          "findings": {
            "type": "object",
            "required": [
              "errors",
              "warnings",
              "acknowledgedWarnings",
              "unacknowledgedWarnings"
            ],
            "additionalProperties": false,
            "properties": {
              "errors": {
                "type": "integer"
              },
              "warnings": {
                "type": "integer"
              },
              "acknowledgedWarnings": {
                "type": "integer"
              },
              "unacknowledgedWarnings": {
                "type": "integer"
              }
            }
          },
          "publishBlocked": {
            "type": "boolean"
          },
          "blockReasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "AUTHORING_CONTRADICTION",
                "AUTHORING_ACK_REQUIRED"
              ]
            }
          }
        }
      },
      "LmsAuthoringAnalysis": {
        "type": "object",
        "description": "DEV-3198 / DEV-3028 authoring diagnostics computed by ONE canonical analyzer over the exact resolved form versions publishing would freeze. Validate never writes; publish fails closed with AUTHORING_CONTRADICTION (400) or AUTHORING_ACK_REQUIRED (409).",
        "required": [
          "schemaVersion",
          "validationIntent",
          "intentSource",
          "findings",
          "summary",
          "staleAcknowledgements"
        ],
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "validationIntent": {
            "type": "string",
            "enum": [
              "STANDARD",
              "INDIVIDUAL_MASTERY"
            ]
          },
          "intentSource": {
            "type": "string",
            "enum": [
              "REQUEST",
              "DRAFT",
              "DEFAULT"
            ]
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsAuthoringFinding"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/LmsAuthoringSummary"
          },
          "staleAcknowledgements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsAuthoringAcknowledgement"
            }
          }
        }
      },
      "LmsCanonicalLink": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "audience",
          "url",
          "jobId",
          "courseId",
          "courseVersionId",
          "moduleKey",
          "lessonKey",
          "assignmentId",
          "contractId"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "JOB_TRAINING",
              "COURSE_LIBRARY",
              "COURSE",
              "COURSE_PREVIEW",
              "COURSE_VERSION",
              "MODULE",
              "LESSON",
              "ASSESSMENT",
              "ASSIGNMENT",
              "ASSIGNMENT_REVIEW",
              "RELEASE_IMPACT"
            ]
          },
          "audience": {
            "type": "string",
            "enum": [
              "EMPLOYER",
              "LEARNER"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Environment-correct human navigation URL. It contains no credential or authorization grant; the destination reauthorizes the actor."
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "courseId": {
            "type": [
              "string",
              "null"
            ]
          },
          "courseVersionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "moduleKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "lessonKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "assignmentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "contractId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "LmsMasteryLatestOutcome": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "runNumber",
          "status",
          "wrongCount",
          "unansweredCount"
        ],
        "properties": {
          "runNumber": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "PASSED",
              "FAILED"
            ]
          },
          "wrongCount": {
            "type": "integer",
            "minimum": 0
          },
          "unansweredCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "LmsMasteryProjection": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "runLimit",
          "effectiveRunLimit",
          "submittedRuns",
          "runsRemaining",
          "exhausted",
          "liveRunNumber",
          "latestOutcome",
          "antiGuessPolicy",
          "retryAvailableAt"
        ],
        "properties": {
          "runLimit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "effectiveRunLimit": {
            "type": "integer",
            "minimum": 1
          },
          "submittedRuns": {
            "type": "integer",
            "minimum": 0
          },
          "runsRemaining": {
            "type": "integer",
            "minimum": 0
          },
          "exhausted": {
            "type": "boolean"
          },
          "liveRunNumber": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "latestOutcome": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LmsMasteryLatestOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "antiGuessPolicy": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "schemaVersion",
                  "cooldownStepsSeconds",
                  "restartScope"
                ],
                "properties": {
                  "schemaVersion": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "cooldownStepsSeconds": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3600
                    }
                  },
                  "restartScope": {
                    "type": "string",
                    "enum": [
                      "WHOLE_MODULE",
                      "MISSED_QUESTIONS"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "retryAvailableAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "LmsCourseRun": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "runNumber",
          "status",
          "startedAt",
          "submittedAt",
          "wrongCount",
          "unansweredCount"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "runNumber": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "IN_PROGRESS",
              "PASSED",
              "FAILED"
            ]
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "submittedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "wrongCount": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "unansweredCount": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        }
      },
      "LmsRosterEntry": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contractId",
          "workerUserId",
          "displayName",
          "contractStatus",
          "assignable"
        ],
        "properties": {
          "contractId": {
            "type": "string"
          },
          "workerUserId": {
            "type": "string"
          },
          "displayName": {
            "type": "string",
            "description": "Masked worker display name. Email is never included."
          },
          "contractStatus": {
            "type": "string",
            "enum": [
              "active",
              "ended"
            ]
          },
          "assignable": {
            "type": "boolean"
          }
        }
      },
      "LmsQuestionResultsOption": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "optionId",
          "label",
          "correct",
          "count"
        ],
        "properties": {
          "optionId": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "correct": {
            "type": "boolean",
            "description": "True for a correct choice."
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "description": "People who picked this choice on their first submitted attempt."
          }
        }
      },
      "LmsQuestionResultsMiss": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "personId",
          "name",
          "attemptId",
          "outcome",
          "answer"
        ],
        "properties": {
          "personId": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Masked display name (first name and last initial, \"First L.\"). Email is never included."
          },
          "attemptId": {
            "type": "string",
            "description": "The first submitted attempt that was counted."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "INCORRECT",
              "PARTIAL",
              "SKIPPED"
            ]
          },
          "answer": {
            "type": [
              "string",
              "null"
            ],
            "description": "The submitted answer as display text; null when the question was skipped."
          }
        }
      },
      "LmsQuestionResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "questionId",
          "number",
          "prompt",
          "type",
          "grading",
          "points",
          "counts",
          "correctPercent",
          "options",
          "missedBy"
        ],
        "properties": {
          "questionId": {
            "type": "string"
          },
          "number": {
            "type": "integer",
            "minimum": 1,
            "description": "One-based position among the answerable questions of the quiz version."
          },
          "prompt": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "Native Forms question type."
          },
          "grading": {
            "type": "string",
            "enum": [
              "AUTO",
              "MANUAL",
              "UNGRADED"
            ],
            "description": "AUTO is answer-key graded, MANUAL is employer graded, UNGRADED carries no score."
          },
          "points": {
            "type": [
              "number",
              "null"
            ]
          },
          "counts": {
            "type": "object",
            "additionalProperties": false,
            "description": "People per outcome on their first submitted attempt. AWAITING_GRADE is a manual question with no grade yet; NOT_GRADED is an answered ungraded question.",
            "required": [
              "CORRECT",
              "INCORRECT",
              "PARTIAL",
              "SKIPPED",
              "AWAITING_GRADE",
              "NOT_GRADED"
            ],
            "properties": {
              "CORRECT": {
                "type": "integer",
                "minimum": 0
              },
              "INCORRECT": {
                "type": "integer",
                "minimum": 0
              },
              "PARTIAL": {
                "type": "integer",
                "minimum": 0
              },
              "SKIPPED": {
                "type": "integer",
                "minimum": 0
              },
              "AWAITING_GRADE": {
                "type": "integer",
                "minimum": 0
              },
              "NOT_GRADED": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "correctPercent": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "Correct share (0-100) of the people with a final grade on this question; null when nobody has one."
          },
          "options": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/LmsQuestionResultsOption"
            },
            "description": "Choice questions only: per-choice pick counts with the correct choice marked."
          },
          "missedBy": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsQuestionResultsMiss"
            },
            "description": "People who got the question wrong, partly right, or skipped a graded question."
          }
        }
      },
      "LmsQuizQuestionResults": {
        "type": "object",
        "additionalProperties": false,
        "description": "One group per course, lesson and quiz version.",
        "required": [
          "courseId",
          "courseTitle",
          "moduleTitle",
          "lessonKey",
          "lessonTitle",
          "formId",
          "formVersionId",
          "formVersionNumber",
          "peopleCount",
          "questions"
        ],
        "properties": {
          "courseId": {
            "type": "string"
          },
          "courseTitle": {
            "type": "string"
          },
          "moduleTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "lessonKey": {
            "type": "string"
          },
          "lessonTitle": {
            "type": "string"
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": "string"
          },
          "formVersionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "peopleCount": {
            "type": "integer",
            "minimum": 0,
            "description": "People counted, one first submitted attempt each."
          },
          "questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsQuestionResult"
            }
          }
        }
      },
      "LmsQuestionResults": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jobId",
          "audience",
          "basis",
          "quizzes",
          "truncated"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "audience": {
            "type": "string",
            "enum": [
              "HIRED",
              "APPLICANT"
            ],
            "description": "HIRED counts Training attempts by hired workers; APPLICANT counts screening attempts."
          },
          "basis": {
            "type": "string",
            "enum": [
              "FIRST_SUBMITTED_ATTEMPT"
            ]
          },
          "quizzes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsQuizQuestionResults"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the 5000 attempt cap was reached; the oldest attempts were kept."
          }
        }
      },
      "LmsAttributionActor": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "userId",
          "membership",
          "displayName",
          "email"
        ],
        "description": "Stable actor id, always present. displayName/email are populated ONLY when the actor is a current identity of the reading organization (its owner or a non-removed member); otherwise they are null.",
        "properties": {
          "userId": {
            "type": "string"
          },
          "membership": {
            "type": "string",
            "enum": [
              "CURRENT_MEMBER",
              "NOT_CURRENT_MEMBER"
            ]
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "LmsAttributionSlot": {
        "description": "One attributed action. AVAILABLE names the actor, instant, and canonical source; NOT_AVAILABLE carries an explicit reason (NO_MATERIAL_UPDATE, NO_AUDIT_HISTORY, ACTOR_UNRESOLVED) and keeps the known instant/source when only the actor is missing.",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "status",
              "actor",
              "at",
              "source"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "AVAILABLE"
                ]
              },
              "actor": {
                "$ref": "#/components/schemas/LmsAttributionActor"
              },
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "source": {
                "type": "string",
                "enum": [
                  "COURSE_RECORD",
                  "VERSION_RECORD",
                  "AUDIT_EVENT"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "status",
              "notAvailableReason",
              "at",
              "source"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "NOT_AVAILABLE"
                ]
              },
              "notAvailableReason": {
                "type": "string",
                "enum": [
                  "NO_MATERIAL_UPDATE",
                  "NO_AUDIT_HISTORY",
                  "ACTOR_UNRESOLVED"
                ]
              },
              "at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "COURSE_RECORD",
                  "VERSION_RECORD",
                  "AUDIT_EVENT",
                  null
                ]
              }
            }
          }
        ]
      },
      "LmsCourseAttribution": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "createdBy",
          "lastUpdatedBy"
        ],
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "createdBy": {
            "$ref": "#/components/schemas/LmsAttributionSlot"
          },
          "lastUpdatedBy": {
            "$ref": "#/components/schemas/LmsAttributionSlot"
          }
        }
      },
      "LmsCourseVersionAttribution": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "authoredBy",
          "publishedBy"
        ],
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "authoredBy": {
            "$ref": "#/components/schemas/LmsAttributionSlot"
          },
          "publishedBy": {
            "$ref": "#/components/schemas/LmsAttributionSlot"
          }
        }
      },
      "LmsModuleMasteryEligibility": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "eligible",
          "reason"
        ],
        "properties": {
          "eligible": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable LMS_MASTERY_ERRORS key when the module is ineligible."
          }
        }
      },
      "LmsVersionModule": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "title",
          "order",
          "lessonCount",
          "mastery"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "order": {
            "type": "integer",
            "minimum": 0
          },
          "lessonCount": {
            "type": "integer",
            "minimum": 0
          },
          "mastery": {
            "$ref": "#/components/schemas/LmsModuleMasteryEligibility"
          }
        }
      },
      "LmsAnswerKeyItem": {
        "description": "One entry of an employer-only quiz answer key, in quiz order. SECTION and TITLE entries are layout only; QUESTION entries are numbered among answerable questions.",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "id",
              "title",
              "description"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SECTION"
                ]
              },
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "id",
              "text"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "TITLE"
                ]
              },
              "id": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "id",
              "number",
              "type",
              "prompt",
              "required",
              "grading",
              "points",
              "options",
              "expectedAnswer",
              "matchingNotes",
              "scale"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "QUESTION"
                ]
              },
              "id": {
                "type": "string"
              },
              "number": {
                "type": "integer",
                "minimum": 1,
                "description": "1-based position among answerable questions."
              },
              "type": {
                "type": "string",
                "description": "Native Forms question type (for example MULTIPLE_CHOICE, CHECKBOXES, DROPDOWN, SHORT_TEXT, PARAGRAPH, NUMBER, LINEAR_SCALE, DATE)."
              },
              "prompt": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "grading": {
                "type": "string",
                "enum": [
                  "AUTO",
                  "MANUAL",
                  "UNGRADED"
                ],
                "description": "AUTO is scored against the key below; MANUAL is graded by a reviewer (including text questions without a key); UNGRADED carries no points."
              },
              "points": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Null when ungraded."
              },
              "options": {
                "oneOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "label",
                        "correct"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "correct": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Choice questions only, in display order, with the correct choices marked."
              },
              "expectedAnswer": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Non-choice auto-graded questions: the expected answer as display text."
              },
              "matchingNotes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Matching rules for the expected answer (tolerance, partial credit, case)."
              },
              "scale": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "min",
                      "max",
                      "minLabel",
                      "maxLabel"
                    ],
                    "properties": {
                      "min": {
                        "type": "number"
                      },
                      "max": {
                        "type": "number"
                      },
                      "minLabel": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "maxLabel": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "LINEAR_SCALE only."
              }
            }
          }
        ]
      },
      "LmsAssessmentAnswerKey": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "totalPoints",
          "passRule",
          "questionCount",
          "items"
        ],
        "properties": {
          "totalPoints": {
            "type": "number",
            "minimum": 0
          },
          "passRule": {
            "type": [
              "string",
              "null"
            ],
            "description": "Human-readable pass rule, or null when the quiz has none."
          },
          "questionCount": {
            "type": "integer",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsAnswerKeyItem"
            }
          }
        }
      },
      "LmsCourseAnswerKeyAssessment": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "lessonKey",
          "title",
          "formId",
          "formVersionId",
          "formVersionNumber",
          "problem",
          "answerKey"
        ],
        "properties": {
          "lessonKey": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "formId": {
            "type": "string"
          },
          "formVersionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The quiz version the key comes from; null when the draft quiz has none."
          },
          "formVersionNumber": {
            "type": [
              "integer",
              "null"
            ]
          },
          "problem": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why this quiz has no answer key (unpublished, archived, or missing); null when it has one."
          },
          "answerKey": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LmsAssessmentAnswerKey"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "LmsCourseAnswerKey": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "courseId",
          "source",
          "courseVersionId",
          "courseVersionNumber",
          "modules",
          "assessmentCount",
          "questionCount"
        ],
        "properties": {
          "courseId": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "DRAFT",
              "PUBLISHED"
            ],
            "description": "DRAFT resolves each quiz the way publishing would freeze it; PUBLISHED reads the immutable pins of one published version."
          },
          "courseVersionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Published view only."
          },
          "courseVersionNumber": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Published view only."
          },
          "modules": {
            "type": "array",
            "description": "Modules that contain at least one quiz lesson, in course order.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "key",
                "title",
                "assessments"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "assessments": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LmsCourseAnswerKeyAssessment"
                  }
                }
              }
            }
          },
          "assessmentCount": {
            "type": "integer",
            "minimum": 0
          },
          "questionCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "LmsAssignmentRecord": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "itemId",
          "contractId",
          "waitingOnRole",
          "title",
          "assignedAt",
          "dueAt",
          "submittedAt",
          "completedAt",
          "bindingId",
          "courseId",
          "courseVersionId",
          "courseVersionNumber",
          "courseTitle",
          "moduleKeys",
          "completionPolicy",
          "status",
          "lessonProgress",
          "masteryMode",
          "masteryRunLimit",
          "masteryAntiGuessPolicy",
          "mastery",
          "links"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "itemId": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "waitingOnRole": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "assignedAt": {
            "type": "string",
            "format": "date-time"
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "submittedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "bindingId": {
            "type": [
              "string",
              "null"
            ]
          },
          "courseId": {
            "type": [
              "string",
              "null"
            ]
          },
          "courseVersionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "courseVersionNumber": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "courseTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "courseDescription": {
            "type": [
              "string",
              "null"
            ],
            "description": "Description of the effective course version; null when the assignment has no LMS binding or the version has no description."
          },
          "moduleKeys": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "completionPolicy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "SYSTEM",
              "EMPLOYER_REVIEW",
              null
            ]
          },
          "status": {
            "type": "string"
          },
          "lessonProgress": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "lessonKey",
                "status"
              ],
              "properties": {
                "lessonKey": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              }
            }
          },
          "masteryMode": {
            "type": "boolean"
          },
          "masteryRunLimit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 10
          },
          "masteryAntiGuessPolicy": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "schemaVersion",
                  "cooldownStepsSeconds",
                  "restartScope"
                ],
                "properties": {
                  "schemaVersion": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "cooldownStepsSeconds": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3600
                    }
                  },
                  "restartScope": {
                    "type": "string",
                    "enum": [
                      "WHOLE_MODULE",
                      "MISSED_QUESTIONS"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "mastery": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LmsMasteryProjection"
              },
              {
                "type": "null"
              }
            ]
          },
          "assessmentResults": {
            "type": "array",
            "description": "Optional worker-masked released-result projection. Correct values and answer keys are never serialized.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LmsCanonicalLink"
            }
          }
        }
      },
      "LmsAssignmentPlanRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jobId",
          "courseId",
          "expectedCourseVersionId",
          "completionPolicy",
          "audience"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "courseId": {
            "type": "string"
          },
          "expectedCourseVersionId": {
            "type": "string"
          },
          "moduleKeys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "maxItems": 50
          },
          "completionPolicy": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "EMPLOYER_REVIEW"
            ]
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "selectedContractIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 500
          },
          "masteryMode": {
            "type": "boolean"
          },
          "masteryRunLimit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 3
          },
          "masteryAntiGuessPolicy": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "schemaVersion",
              "cooldownStepsSeconds",
              "restartScope"
            ],
            "properties": {
              "schemaVersion": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "cooldownStepsSeconds": {
                "type": "array",
                "minItems": 1,
                "maxItems": 10,
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                }
              },
              "restartScope": {
                "type": "string",
                "enum": [
                  "WHOLE_MODULE",
                  "MISSED_QUESTIONS"
                ]
              }
            }
          },
          "categoryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "required": {
            "type": "boolean",
            "default": true
          },
          "priority": {
            "type": "string",
            "enum": [
              "NORMAL",
              "HIGH",
              "URGENT"
            ]
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ]
          },
          "dueOffsetMinutes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "unlocksItemIds": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "string"
            },
            "description": "Existing Project To-do item ids on the job that stay locked for each person until they complete this training. The training is added as a prerequisite in the same transaction; unfinished copies re-lock until it is done. When sent, the token also needs `project_todos:read` to plan and `project_todos:write` to create."
          }
        }
      },
      "LmsAssignmentPlanReceipt": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "organizationId",
          "jobId",
          "jobTitle",
          "course",
          "courseVersionId",
          "courseVersionNumber",
          "moduleKeys",
          "masteryMode",
          "masteryRunLimit",
          "masteryAntiGuessPolicy",
          "worker",
          "audience",
          "includesFutureHires",
          "matchedContracts",
          "due",
          "blocking",
          "eligibility",
          "warnings",
          "requestHash",
          "receipt"
        ],
        "properties": {
          "organizationId": {
            "type": "string"
          },
          "jobId": {
            "type": "string"
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "course": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "title"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "courseVersionId": {
            "type": "string"
          },
          "courseVersionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "moduleKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "masteryMode": {
            "type": "boolean"
          },
          "masteryRunLimit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 10
          },
          "masteryAntiGuessPolicy": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "schemaVersion",
                  "cooldownStepsSeconds",
                  "restartScope"
                ],
                "properties": {
                  "schemaVersion": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "cooldownStepsSeconds": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3600
                    }
                  },
                  "restartScope": {
                    "type": "string",
                    "enum": [
                      "WHOLE_MODULE",
                      "MISSED_QUESTIONS"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "worker": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contractId",
                  "workerUserId",
                  "displayName"
                ],
                "properties": {
                  "contractId": {
                    "type": "string"
                  },
                  "workerUserId": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "includesFutureHires": {
            "type": "boolean"
          },
          "matchedContracts": {
            "type": "integer",
            "minimum": 0
          },
          "due": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "dueOffsetMinutes",
              "deadline"
            ],
            "properties": {
              "dueOffsetMinutes": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              },
              "deadline": {
                "description": "Exact frozen due instant the assignment applies verbatim (DEV-2987 retraining plans always carry one; standard assignment plans keep null).",
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "schemaVersion",
                      "localDate",
                      "localTime",
                      "timeZone",
                      "dueAt"
                    ],
                    "properties": {
                      "schemaVersion": {
                        "type": "integer",
                        "enum": [
                          1
                        ]
                      },
                      "localDate": {
                        "type": "string"
                      },
                      "localTime": {
                        "type": "string"
                      },
                      "timeZone": {
                        "type": "string"
                      },
                      "dueAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "blocking": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "blockingMode",
              "required",
              "priority"
            ],
            "properties": {
              "blockingMode": {
                "type": "string",
                "enum": [
                  "NONE",
                  "IMMEDIATE",
                  "AFTER_DUE"
                ]
              },
              "required": {
                "type": "boolean"
              },
              "priority": {
                "type": "string",
                "enum": [
                  "NORMAL",
                  "HIGH",
                  "URGENT"
                ]
              }
            }
          },
          "eligibility": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LmsModuleMasteryEligibility"
              },
              {
                "type": "null"
              }
            ]
          },
          "unlocks": {
            "type": "array",
            "description": "\"Unlock after this training\" targets and how many unfinished copies each re-locks.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "itemId",
                "title",
                "autoAssignNewHires",
                "relocksCount"
              ],
              "properties": {
                "itemId": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "autoAssignNewHires": {
                  "type": "boolean"
                },
                "relocksCount": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "requestHash": {
            "type": "string"
          },
          "receipt": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "token",
              "expiresAt"
            ],
            "properties": {
              "token": {
                "type": "string"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "LmsPreviewSession": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "courseId",
          "source",
          "moduleKey",
          "lessonKey",
          "itemId",
          "masteryMode",
          "completionPolicy",
          "authoringIntentSource",
          "renderRevision",
          "stateRevision",
          "rendererView",
          "createdAt",
          "expiresAt",
          "rendererUrl",
          "capture"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "LIVE",
              "EXPIRED"
            ]
          },
          "courseId": {
            "type": "string"
          },
          "source": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "draftRevision"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "draft"
                    ]
                  },
                  "draftRevision": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "publishedVersionId"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "version"
                    ]
                  },
                  "publishedVersionId": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "moduleKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "lessonKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "itemId": {
            "type": [
              "string",
              "null"
            ]
          },
          "masteryMode": {
            "type": "boolean"
          },
          "completionPolicy": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "EMPLOYER_REVIEW"
            ]
          },
          "authoringIntentSource": {
            "type": "string",
            "enum": [
              "REQUEST",
              "DRAFT",
              "DEFAULT"
            ]
          },
          "renderRevision": {
            "type": "string"
          },
          "stateRevision": {
            "type": "integer",
            "minimum": 1
          },
          "rendererView": {
            "type": "string",
            "enum": [
              "WORKER",
              "EMPLOYER_REVIEW"
            ],
            "description": "The frame the hosted renderer currently shows (DEV-2757): WORKER by default; EMPLOYER_REVIEW after `select_view`. A render that asserts `view` must match it."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "rendererUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "capture": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "readyAttribute",
              "viewports"
            ],
            "properties": {
              "readyAttribute": {
                "type": "string",
                "enum": [
                  "data-lms-preview-ready"
                ]
              },
              "viewports": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "desktop",
                  "mobile"
                ],
                "properties": {
                  "desktop": {
                    "type": "object",
                    "required": [
                      "width",
                      "height"
                    ],
                    "properties": {
                      "width": {
                        "const": 1440
                      },
                      "height": {
                        "const": 900
                      }
                    }
                  },
                  "mobile": {
                    "type": "object",
                    "required": [
                      "width",
                      "height"
                    ],
                    "properties": {
                      "width": {
                        "const": 390
                      },
                      "height": {
                        "const": 844
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "LmsPreviewArtifact": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "sessionId",
          "status",
          "kind",
          "viewport",
          "phase",
          "moduleKey",
          "lessonKey",
          "itemId",
          "checksumSha256",
          "byteSize",
          "renderRevision",
          "capturedAt",
          "expiresAt",
          "failure",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "READY",
              "FAILED",
              "EXPIRED"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "PNG",
              "MANIFEST",
              "ARIA_SNAPSHOT",
              "DIAGNOSTICS",
              "PDF",
              "HTML"
            ]
          },
          "viewport": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "desktop",
              "mobile",
              null
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "RENDER",
              "BEFORE_STEP",
              "AFTER_STEP",
              "NONE"
            ]
          },
          "moduleKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "lessonKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "itemId": {
            "type": [
              "string",
              "null"
            ]
          },
          "checksumSha256": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{64}$"
          },
          "byteSize": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "renderRevision": {
            "type": "string"
          },
          "capturedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "failure": {
            "description": "DEV-3029 durable typed capture failure; null unless status is FAILED. Codes are closed; retryable failures re-arm through the SAME prepare key. A PENDING artifact older than the pending TTL sweeps to FAILED (STALE_PENDING_EXPIRED) on the next read — nothing stays silently pending.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code",
                  "retryable",
                  "remediation",
                  "detail",
                  "failedAt"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "RENDERER_UNREACHABLE",
                      "RENDERER_AUTH_REQUIRED",
                      "READY_MARKER_TIMEOUT",
                      "CAPTURE_TIMEOUT",
                      "CAPTURE_CRASH",
                      "UPLOAD_INCOMPLETE",
                      "STALE_PENDING_EXPIRED",
                      "DOCUMENT_LIMIT_EXCEEDED",
                      "DOCUMENT_INCOMPLETE",
                      "DOCUMENT_TIMEOUT"
                    ]
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "remediation": {
                    "type": "string"
                  },
                  "detail": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "failedAt": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "LmsPreviewAuditTarget": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "index",
          "moduleKey",
          "moduleTitle",
          "lessonKey",
          "lessonTitle",
          "lessonKind",
          "state"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0
          },
          "moduleKey": {
            "type": "string"
          },
          "moduleTitle": {
            "type": "string"
          },
          "lessonKey": {
            "type": "string"
          },
          "lessonTitle": {
            "type": "string"
          },
          "lessonKind": {
            "type": "string"
          },
          "state": {
            "description": "CONTENT/ASSESSMENT_UNANSWERED render as-is. The remaining states are DERIVED SERVER-SIDE from the pinned form versions through the canonical graders — clients never see or supply answer keys, and a verdict that cannot prove the requested label fails typed (409 AUDIT_STATE_UNPROVABLE). Mastery proofs exist only on mastery sessions and are module-scoped, anchored to the first assessment lesson.",
            "type": "string",
            "enum": [
              "CONTENT",
              "ASSESSMENT_UNANSWERED",
              "ASSESSMENT_INCORRECT_FEEDBACK",
              "ASSESSMENT_PASSED",
              "MASTERY_RUN_FAILED",
              "MASTERY_CARRY_LOCK_REDO",
              "MASTERY_RUN_PASSED"
            ]
          }
        }
      },
      "LmsPreviewRenderResponse": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "sessionKind": {
            "type": "string",
            "const": "SYNTHETIC_PREVIEW"
          },
          "evidenceClass": {
            "type": "string",
            "const": "SIMULATED_WORKER_PREVIEW"
          },
          "ok": {
            "type": "boolean"
          },
          "stateRevision": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "renderRevision": {
            "type": "string"
          },
          "artifacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "sessionId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "READY",
                    "FAILED",
                    "EXPIRED"
                  ]
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "PNG",
                    "MANIFEST",
                    "ARIA_SNAPSHOT",
                    "DIAGNOSTICS",
                    "PDF",
                    "HTML"
                  ]
                },
                "viewport": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "desktop",
                        "mobile"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "phase": {
                  "type": "string",
                  "enum": [
                    "RENDER",
                    "BEFORE_STEP",
                    "AFTER_STEP",
                    "NONE"
                  ]
                },
                "checksumSha256": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "byteSize": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "renderRevision": {
                  "type": "string"
                },
                "capturedAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expiresAt": {
                  "type": "string"
                },
                "url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "failure": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "RENDERER_UNREACHABLE",
                            "RENDERER_AUTH_REQUIRED",
                            "READY_MARKER_TIMEOUT",
                            "CAPTURE_TIMEOUT",
                            "CAPTURE_CRASH",
                            "UPLOAD_INCOMPLETE",
                            "STALE_PENDING_EXPIRED",
                            "DOCUMENT_LIMIT_EXCEEDED",
                            "DOCUMENT_INCOMPLETE",
                            "DOCUMENT_TIMEOUT"
                          ]
                        },
                        "retryable": {
                          "type": "boolean"
                        },
                        "remediation": {
                          "type": "string"
                        },
                        "detail": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "failedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "retryable",
                        "remediation",
                        "detail",
                        "failedAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "moduleKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lessonKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "itemId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "sessionId",
                "status",
                "kind",
                "viewport",
                "phase",
                "checksumSha256",
                "byteSize",
                "renderRevision",
                "capturedAt",
                "expiresAt",
                "url",
                "failure",
                "moduleKey",
                "lessonKey",
                "itemId"
              ],
              "additionalProperties": false
            }
          },
          "manifest": {
            "type": "object",
            "properties": {
              "sessionId": {
                "type": "string"
              },
              "sessionKind": {
                "type": "string",
                "const": "SYNTHETIC_PREVIEW"
              },
              "evidenceClass": {
                "type": "string",
                "const": "SIMULATED_WORKER_PREVIEW"
              },
              "schemaVersion": {
                "type": "string",
                "const": "opentrain-preview-manifest/1"
              },
              "provenance": {
                "type": "object",
                "properties": {
                  "appCommit": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rendererVersion": {
                    "type": "string"
                  },
                  "sourceDigest": {
                    "type": "string"
                  },
                  "stateRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "capturedAt": {
                    "type": "string"
                  },
                  "locale": {
                    "type": "string"
                  }
                },
                "required": [
                  "appCommit",
                  "rendererVersion",
                  "sourceDigest",
                  "stateRevision",
                  "capturedAt",
                  "locale"
                ],
                "additionalProperties": false
              },
              "evidenceArtifacts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "artifactId": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "PNG",
                        "ARIA_SNAPSHOT",
                        "DIAGNOSTICS",
                        "PDF",
                        "HTML"
                      ]
                    },
                    "viewport": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "desktop",
                            "mobile"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "phase": {
                      "type": "string",
                      "enum": [
                        "RENDER",
                        "BEFORE_STEP",
                        "AFTER_STEP",
                        "NONE"
                      ]
                    },
                    "checksumSha256": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "byteSize": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "artifactId",
                    "kind",
                    "viewport",
                    "phase",
                    "checksumSha256",
                    "byteSize"
                  ],
                  "additionalProperties": false
                }
              },
              "diagnostics": {
                "type": "object",
                "properties": {
                  "consoleErrorCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "consoleWarningCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "pageErrorCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "failedRequestCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "readyWaitMs": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "consoleErrorCount",
                  "consoleWarningCount",
                  "pageErrorCount",
                  "failedRequestCount",
                  "readyWaitMs"
                ],
                "additionalProperties": false
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "document": {
                "type": "object",
                "properties": {
                  "pageCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 40
                  },
                  "unitCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200
                  },
                  "representation": {
                    "type": "string",
                    "const": "WORKER_VIEW_RASTER"
                  },
                  "complete": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "pageCount",
                  "unitCount",
                  "representation",
                  "complete"
                ],
                "additionalProperties": false
              },
              "product": {
                "type": "string",
                "const": "LMS_COURSE"
              },
              "target": {
                "type": "object",
                "properties": {
                  "product": {
                    "type": "string",
                    "const": "LMS_COURSE"
                  },
                  "moduleKey": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "lessonKey": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "itemId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "view": {
                    "type": "string",
                    "enum": [
                      "WORKER",
                      "EMPLOYER_REVIEW"
                    ]
                  }
                },
                "required": [
                  "product",
                  "moduleKey",
                  "lessonKey",
                  "itemId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "sessionId",
              "sessionKind",
              "evidenceClass",
              "schemaVersion",
              "provenance",
              "evidenceArtifacts",
              "diagnostics",
              "warnings",
              "product",
              "target"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "sessionId",
          "sessionKind",
          "evidenceClass",
          "ok",
          "stateRevision",
          "renderRevision",
          "artifacts",
          "manifest"
        ],
        "additionalProperties": false
      },
      "PreviewEvidenceArtifact": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "READY",
              "FAILED",
              "EXPIRED"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "PNG",
              "MANIFEST",
              "ARIA_SNAPSHOT",
              "DIAGNOSTICS",
              "PDF",
              "HTML"
            ]
          },
          "viewport": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "desktop",
                  "mobile"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "RENDER",
              "BEFORE_STEP",
              "AFTER_STEP",
              "NONE"
            ]
          },
          "checksumSha256": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "byteSize": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "renderRevision": {
            "type": "string"
          },
          "capturedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "failure": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "RENDERER_UNREACHABLE",
                      "RENDERER_AUTH_REQUIRED",
                      "READY_MARKER_TIMEOUT",
                      "CAPTURE_TIMEOUT",
                      "CAPTURE_CRASH",
                      "UPLOAD_INCOMPLETE",
                      "STALE_PENDING_EXPIRED",
                      "DOCUMENT_LIMIT_EXCEEDED",
                      "DOCUMENT_INCOMPLETE",
                      "DOCUMENT_TIMEOUT"
                    ]
                  },
                  "retryable": {
                    "type": "boolean"
                  },
                  "remediation": {
                    "type": "string"
                  },
                  "detail": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "failedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "retryable",
                  "remediation",
                  "detail",
                  "failedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "sessionId",
          "status",
          "kind",
          "viewport",
          "phase",
          "checksumSha256",
          "byteSize",
          "renderRevision",
          "capturedAt",
          "expiresAt",
          "url",
          "failure"
        ],
        "additionalProperties": false
      },
      "PreviewObserveLink": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "sessionId",
          "mode",
          "status",
          "createdAt",
          "consumedAt",
          "expiresAt",
          "revokedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "OBSERVE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "CONSUMED",
              "REVOKED",
              "EXPIRED"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "consumedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "PreviewSourceDrift": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "pinnedDigest",
          "observedDigest",
          "changed",
          "observedAt"
        ],
        "properties": {
          "pinnedDigest": {
            "type": "string"
          },
          "observedDigest": {
            "type": "string"
          },
          "changed": {
            "type": "boolean",
            "description": "The only field an agent may branch on."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PreviewWorkerCoverage": {
        "description": "Worker-coverage honesty. included:true is valid ONLY for evidence captured through a real designated test-worker contract; anything else is a typed gap (Instructions never reports NOT_APPLICABLE).",
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "included",
              "basis",
              "contractId",
              "evidenceClass"
            ],
            "properties": {
              "included": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "basis": {
                "type": "string",
                "enum": [
                  "REAL_TEST_WORKER_CONTRACT"
                ]
              },
              "contractId": {
                "type": "string"
              },
              "evidenceClass": {
                "type": "string",
                "enum": [
                  "AUTHENTICATED_APP_VIEW"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "included",
              "reason",
              "requirement"
            ],
            "properties": {
              "included": {
                "type": "boolean",
                "enum": [
                  false
                ]
              },
              "reason": {
                "type": "string",
                "enum": [
                  "NO_TEST_WORKER_CONTRACT",
                  "CONTRACT_NOT_TEST_WORKER",
                  "CONTRACT_NOT_ACTIVE",
                  "WORKER_ACCESS_DENIED",
                  "NOT_APPLICABLE"
                ]
              },
              "requirement": {
                "type": "string"
              }
            }
          }
        ]
      },
      "PreviewArtifactManifest": {
        "type": "object",
        "description": "Provenance manifest bundled with every hosted render (schemaVersion opentrain-preview-manifest/1): product, target, session kind/evidence class, provenance (app commit, renderer version, source digest, state revision, capture time, locale), the checksum/size of every evidence artifact, renderer diagnostics, warnings, and — for JOB_INSTRUCTIONS — sourceDrift and workerCoverage.",
        "required": [
          "schemaVersion",
          "product",
          "target",
          "sessionKind",
          "evidenceClass",
          "sessionId",
          "provenance",
          "evidenceArtifacts",
          "diagnostics",
          "warnings"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string"
          },
          "product": {
            "type": "string",
            "enum": [
              "LMS_COURSE",
              "NATIVE_FORM",
              "JOB_INSTRUCTIONS"
            ]
          },
          "target": {
            "type": "object"
          },
          "sessionKind": {
            "type": "string",
            "enum": [
              "SYNTHETIC_PREVIEW",
              "SCOPED_APP_VIEW"
            ]
          },
          "evidenceClass": {
            "type": "string",
            "enum": [
              "SIMULATED_WORKER_PREVIEW",
              "AUTHENTICATED_APP_VIEW"
            ]
          },
          "sessionId": {
            "type": "string"
          },
          "provenance": {
            "type": "object",
            "required": [
              "appCommit",
              "rendererVersion",
              "sourceDigest",
              "stateRevision",
              "capturedAt",
              "locale"
            ],
            "properties": {
              "appCommit": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rendererVersion": {
                "type": "string"
              },
              "sourceDigest": {
                "type": "string"
              },
              "stateRevision": {
                "type": "integer"
              },
              "capturedAt": {
                "type": "string",
                "format": "date-time"
              },
              "locale": {
                "type": "string"
              }
            }
          },
          "evidenceArtifacts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "artifactId",
                "kind",
                "viewport",
                "phase",
                "checksumSha256",
                "byteSize"
              ],
              "properties": {
                "artifactId": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "viewport": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "phase": {
                  "type": "string"
                },
                "checksumSha256": {
                  "type": "string"
                },
                "byteSize": {
                  "type": "integer"
                }
              }
            }
          },
          "diagnostics": {
            "type": "object"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "document": {
            "$schema": "http://json-schema.org/draft-07/schema#",
            "type": "object",
            "properties": {
              "pageCount": {
                "type": "integer",
                "minimum": 1,
                "maximum": 40
              },
              "unitCount": {
                "type": "integer",
                "minimum": 1,
                "maximum": 200
              },
              "representation": {
                "type": "string",
                "const": "WORKER_VIEW_RASTER"
              },
              "complete": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "pageCount",
              "unitCount",
              "representation",
              "complete"
            ],
            "additionalProperties": false
          },
          "sourceDrift": {
            "$ref": "#/components/schemas/PreviewSourceDrift"
          },
          "workerCoverage": {
            "$ref": "#/components/schemas/PreviewWorkerCoverage"
          }
        }
      },
      "NativeFormPreviewSourcePin": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "formId",
              "draftRevision",
              "contentHash"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "draft"
                ]
              },
              "formId": {
                "type": "string"
              },
              "draftRevision": {
                "type": "integer",
                "minimum": 0
              },
              "contentHash": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "formId",
              "formVersionId",
              "versionNumber",
              "contentHash"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "version"
                ]
              },
              "formId": {
                "type": "string"
              },
              "formVersionId": {
                "type": "string"
              },
              "versionNumber": {
                "type": "integer",
                "minimum": 1
              },
              "contentHash": {
                "type": "string"
              }
            }
          }
        ]
      },
      "NativeFormPreviewSession": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "product",
          "sessionKind",
          "evidenceClass",
          "formId",
          "jobId",
          "formTitle",
          "source",
          "questionId",
          "questionIds",
          "renderRevision",
          "stateRevision",
          "createdAt",
          "expiresAt",
          "rendererUrl",
          "capture",
          "zeroDomainWrites"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "LIVE",
              "EXPIRED"
            ]
          },
          "product": {
            "type": "string",
            "enum": [
              "NATIVE_FORM"
            ]
          },
          "sessionKind": {
            "type": "string",
            "enum": [
              "SYNTHETIC_PREVIEW"
            ]
          },
          "evidenceClass": {
            "type": "string",
            "enum": [
              "SIMULATED_WORKER_PREVIEW"
            ]
          },
          "formId": {
            "type": "string"
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "formTitle": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/NativeFormPreviewSourcePin"
          },
          "questionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "questionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "renderRevision": {
            "type": "string"
          },
          "stateRevision": {
            "type": "integer",
            "minimum": 1
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "rendererUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "One-time renderer capability URL (fragment secret); minting response and identical same-key replays only."
          },
          "capture": {
            "type": "object",
            "required": [
              "readyAttribute",
              "viewports"
            ],
            "properties": {
              "readyAttribute": {
                "type": "string"
              },
              "viewports": {
                "type": "object"
              }
            }
          },
          "zeroDomainWrites": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "InstructionsVisualSourcePin": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jobId",
          "instructionSetId",
          "treeChecksum",
          "pages",
          "pinnedAt"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "instructionSetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "treeChecksum": {
            "type": "string"
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "pageId",
                "title",
                "parentPageId",
                "depth",
                "position",
                "checksum",
                "contentSchemaVersion",
                "shareUrl"
              ],
              "properties": {
                "pageId": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "parentPageId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "depth": {
                  "type": "integer",
                  "enum": [
                    0,
                    1
                  ]
                },
                "position": {
                  "type": "integer",
                  "minimum": 0
                },
                "checksum": {
                  "type": "string"
                },
                "contentSchemaVersion": {
                  "type": "integer",
                  "minimum": 1
                },
                "shareUrl": {
                  "type": "string"
                }
              }
            }
          },
          "pinnedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InstructionsVisualSession": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "product",
          "sessionKind",
          "evidenceClass",
          "jobId",
          "instructionSetId",
          "audience",
          "workerContractId",
          "workerCoverage",
          "pageId",
          "nodeId",
          "source",
          "appUrl",
          "renderRevision",
          "stateRevision",
          "createdAt",
          "expiresAt",
          "rendererUrl",
          "capture",
          "collaborationSyncVerified",
          "zeroDomainWrites"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "LIVE",
              "EXPIRED"
            ]
          },
          "product": {
            "type": "string",
            "enum": [
              "JOB_INSTRUCTIONS"
            ]
          },
          "sessionKind": {
            "type": "string",
            "enum": [
              "SCOPED_APP_VIEW"
            ]
          },
          "evidenceClass": {
            "type": "string",
            "enum": [
              "AUTHENTICATED_APP_VIEW"
            ]
          },
          "jobId": {
            "type": "string"
          },
          "instructionSetId": {
            "type": [
              "string",
              "null"
            ]
          },
          "audience": {
            "type": "string",
            "enum": [
              "EMPLOYER",
              "WORKER"
            ]
          },
          "workerContractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "workerCoverage": {
            "$ref": "#/components/schemas/PreviewWorkerCoverage"
          },
          "pageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "nodeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/InstructionsVisualSourcePin"
          },
          "appUrl": {
            "type": "string"
          },
          "renderRevision": {
            "type": "string"
          },
          "stateRevision": {
            "type": "integer",
            "minimum": 1
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "rendererUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "capture": {
            "type": "object",
            "required": [
              "readyAttribute",
              "viewports"
            ],
            "properties": {
              "readyAttribute": {
                "type": "string"
              },
              "viewports": {
                "type": "object"
              }
            }
          },
          "collaborationSyncVerified": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "zeroDomainWrites": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "FolderInstructionInspectResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "title": {
            "type": "string"
          },
          "instructionSetId": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "delivery": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "LIVE",
                  "PUBLISHED",
                  "UNKNOWN"
                ]
              },
              "limitations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "writesSupported": {
                "type": "boolean"
              }
            },
            "required": [
              "mode",
              "limitations",
              "writesSupported"
            ],
            "additionalProperties": false
          },
          "pages": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pageId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "parentPageId": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "title": {
                  "type": "string"
                },
                "icon": {
                  "nullable": true,
                  "type": "string"
                },
                "sortOrder": {
                  "type": "integer"
                },
                "contentSchemaVersion": {
                  "type": "integer"
                },
                "archived": {
                  "type": "boolean"
                },
                "shareUrl": {
                  "type": "string",
                  "format": "uri"
                },
                "workerVisible": {
                  "nullable": true,
                  "type": "boolean"
                },
                "contentAvailability": {
                  "type": "string",
                  "enum": [
                    "NOT_REQUESTED",
                    "AVAILABLE",
                    "MISSING_ROOM",
                    "INVALID_DOCUMENT",
                    "PROVIDER_UNAVAILABLE"
                  ]
                },
                "content": {
                  "nullable": true,
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "doc"
                      ]
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "marks": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "attrs": {
                                  "type": "object",
                                  "additionalProperties": {}
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "content": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/FolderInstructionInspectResponse/properties/pages/items/properties/content/properties/content/items"
                            }
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "type",
                    "content"
                  ],
                  "additionalProperties": false
                },
                "checksum": {
                  "nullable": true,
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "required": [
                "pageId",
                "parentPageId",
                "title",
                "icon",
                "sortOrder",
                "contentSchemaVersion",
                "archived",
                "shareUrl",
                "workerVisible",
                "contentAvailability",
                "content",
                "checksum"
              ],
              "additionalProperties": false
            }
          },
          "jobs": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "jobId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "title": {
                  "type": "string"
                },
                "instructionSetId": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "revision": {
                  "type": "integer",
                  "minimum": 0
                },
                "delivery": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "enum": [
                        "LIVE",
                        "PUBLISHED",
                        "UNKNOWN"
                      ]
                    },
                    "limitations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "writesSupported": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "mode",
                    "limitations",
                    "writesSupported"
                  ],
                  "additionalProperties": false
                },
                "pages": {
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "pageId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "parentPageId": {
                        "nullable": true,
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "title": {
                        "type": "string"
                      },
                      "icon": {
                        "nullable": true,
                        "type": "string"
                      },
                      "sortOrder": {
                        "type": "integer"
                      },
                      "contentSchemaVersion": {
                        "type": "integer"
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "shareUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "workerVisible": {
                        "nullable": true,
                        "type": "boolean"
                      },
                      "contentAvailability": {
                        "type": "string",
                        "enum": [
                          "NOT_REQUESTED",
                          "AVAILABLE",
                          "MISSING_ROOM",
                          "INVALID_DOCUMENT",
                          "PROVIDER_UNAVAILABLE"
                        ]
                      },
                      "content": {
                        "nullable": true,
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "doc"
                            ]
                          },
                          "content": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/FolderInstructionInspectResponse/properties/pages/items/properties/content/properties/content/items"
                            }
                          }
                        },
                        "required": [
                          "type",
                          "content"
                        ],
                        "additionalProperties": false
                      },
                      "checksum": {
                        "nullable": true,
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "pageId",
                      "parentPageId",
                      "title",
                      "icon",
                      "sortOrder",
                      "contentSchemaVersion",
                      "archived",
                      "shareUrl",
                      "workerVisible",
                      "contentAvailability",
                      "content",
                      "checksum"
                    ],
                    "additionalProperties": false
                  }
                },
                "workerPageIds": {
                  "nullable": true,
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                }
              },
              "required": [
                "jobId",
                "title",
                "instructionSetId",
                "revision",
                "delivery",
                "pages",
                "workerPageIds"
              ],
              "additionalProperties": false
            }
          },
          "complete": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "truncated": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "includesContent": {
            "type": "boolean"
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "title",
          "instructionSetId",
          "revision",
          "delivery",
          "pages",
          "jobs",
          "complete",
          "truncated",
          "writesApplied",
          "includesContent"
        ],
        "additionalProperties": false
      },
      "FolderInstructionPreviewRequest": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ACTIVATE",
                  "APPEND"
                ]
              },
              "idempotencyKey": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "sources": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "pageIds": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "ALL"
                          ]
                        },
                        {
                          "maxItems": 500,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          }
                        }
                      ]
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "groupFlatPages": {
                      "type": "boolean"
                    },
                    "includeArchived": {
                      "type": "boolean"
                    },
                    "promoteToRootPageIds": {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    }
                  },
                  "required": [
                    "jobId",
                    "pageIds",
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "newPages": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "ref": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "parentRef": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string",
                      "maxLength": 100
                    },
                    "contentSchemaVersion": {
                      "anyOf": [
                        {
                          "type": "number",
                          "enum": [
                            1
                          ]
                        },
                        {
                          "type": "number",
                          "enum": [
                            2
                          ]
                        }
                      ]
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "doc"
                          ]
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              },
                              "marks": {
                                "maxItems": 100000,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 100
                                    },
                                    "attrs": {
                                      "type": "object",
                                      "additionalProperties": {}
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "text": {
                                "type": "string"
                              },
                              "content": {
                                "maxItems": 100000,
                                "type": "array",
                                "items": {
                                  "$ref": "#/components/schemas/FolderInstructionPreviewRequest/anyOf/0/properties/newPages/items/properties/content/properties/content/items"
                                }
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "content"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ref",
                    "parentRef",
                    "title",
                    "icon",
                    "contentSchemaVersion",
                    "content"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "kind",
              "idempotencyKey",
              "sources",
              "newPages"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "REVERSE"
                ]
              },
              "operationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "idempotencyKey": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              }
            },
            "required": [
              "kind",
              "operationId",
              "idempotencyKey"
            ],
            "additionalProperties": false
          }
        ]
      },
      "FolderInstructionPreviewResponse": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": [
              "opentrain-folder-instructions-plan/1"
            ]
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "actorUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "organizationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "kind": {
            "type": "string",
            "enum": [
              "ACTIVATE",
              "APPEND",
              "REVERSE"
            ]
          },
          "reversal": {
            "type": "object",
            "properties": {
              "operationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "restorePageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "committedVisibilityDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "operationId",
              "restorePageIds",
              "committedVisibilityDigest"
            ],
            "additionalProperties": false
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "canApply": {
            "type": "boolean"
          },
          "baseDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "planDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "pages": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "destinationPageId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "parentRef": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "title": {
                  "type": "string"
                },
                "icon": {
                  "nullable": true,
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": 0
                },
                "contentSchemaVersion": {
                  "type": "integer"
                },
                "content": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "doc"
                      ]
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "marks": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "attrs": {
                                  "type": "object",
                                  "additionalProperties": {}
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "content": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/FolderInstructionPreviewResponse/properties/pages/items/properties/content/properties/content/items"
                            }
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "type",
                    "content"
                  ],
                  "additionalProperties": false
                },
                "checksum": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "source": {
                  "nullable": true,
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "pageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "checksum": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "archived": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "jobId",
                    "pageId",
                    "checksum",
                    "archived"
                  ],
                  "additionalProperties": false
                },
                "mediaBindings": {
                  "maxItems": 2000,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "sourceAssetId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "destinationAssetId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "sourceAssetId",
                      "destinationAssetId"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "ref",
                "destinationPageId",
                "parentRef",
                "title",
                "icon",
                "position",
                "contentSchemaVersion",
                "content",
                "checksum",
                "source"
              ],
              "additionalProperties": false
            }
          },
          "archivePageIds": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "preserveFolderPageIds": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "affectedJobs": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "jobId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "title": {
                  "type": "string"
                },
                "beforePageIds": {
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "afterPageIds": {
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "sourcePages": {
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "pageId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "title": {
                        "type": "string"
                      },
                      "parentPageId": {
                        "nullable": true,
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "disposition": {
                        "type": "string",
                        "enum": [
                          "COPIED_AND_RETAINED",
                          "HIDDEN_AND_RETAINED",
                          "RESTORED_FROM_RETAINED",
                          "UNCHANGED"
                        ]
                      },
                      "destinationPageId": {
                        "nullable": true,
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": [
                      "pageId",
                      "title",
                      "parentPageId",
                      "archived",
                      "disposition",
                      "destinationPageId"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "jobId",
                "title",
                "beforePageIds",
                "afterPageIds",
                "sourcePages"
              ],
              "additionalProperties": false
            }
          },
          "expandedAudience": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ALL_ELIGIBLE_CHILD_JOB_WORKERS"
                ]
              },
              "jobIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "languageLabelsAreAccessControl": {
                "type": "boolean",
                "enum": [
                  false
                ]
              },
              "requiresConfirmation": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            },
            "required": [
              "kind",
              "jobIds",
              "languageLabelsAreAccessControl",
              "requiresConfirmation"
            ],
            "additionalProperties": false
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "ERROR",
                    "WARNING"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "jobId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "pageId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "required": [
                "code",
                "severity",
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "schemaVersion",
          "folderId",
          "actorUserId",
          "organizationId",
          "kind",
          "idempotencyKey",
          "writesApplied",
          "canApply",
          "baseDigest",
          "planDigest",
          "pages",
          "archivePageIds",
          "preserveFolderPageIds",
          "affectedJobs",
          "expandedAudience",
          "findings"
        ],
        "additionalProperties": false
      },
      "FolderInstructionConfirmRequest": {
        "type": "object",
        "properties": {
          "request": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ACTIVATE",
                      "APPEND"
                    ]
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "sources": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "jobId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "pageIds": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ALL"
                              ]
                            },
                            {
                              "maxItems": 500,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            }
                          ]
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "groupFlatPages": {
                          "type": "boolean"
                        },
                        "includeArchived": {
                          "type": "boolean"
                        },
                        "promoteToRootPageIds": {
                          "maxItems": 500,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          }
                        }
                      },
                      "required": [
                        "jobId",
                        "pageIds",
                        "label"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "newPages": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "ref": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "parentRef": {
                          "nullable": true,
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "icon": {
                          "nullable": true,
                          "type": "string",
                          "maxLength": 100
                        },
                        "contentSchemaVersion": {
                          "anyOf": [
                            {
                              "type": "number",
                              "enum": [
                                1
                              ]
                            },
                            {
                              "type": "number",
                              "enum": [
                                2
                              ]
                            }
                          ]
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "doc"
                              ]
                            },
                            "content": {
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  },
                                  "attrs": {
                                    "type": "object",
                                    "additionalProperties": {}
                                  },
                                  "marks": {
                                    "maxItems": 100000,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 100
                                        },
                                        "attrs": {
                                          "type": "object",
                                          "additionalProperties": {}
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "content": {
                                    "maxItems": 100000,
                                    "type": "array",
                                    "items": {
                                      "$ref": "#/components/schemas/FolderInstructionConfirmRequest/properties/request/anyOf/0/properties/newPages/items/properties/content/properties/content/items"
                                    }
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "type",
                            "content"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "ref",
                        "parentRef",
                        "title",
                        "icon",
                        "contentSchemaVersion",
                        "content"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "kind",
                  "idempotencyKey",
                  "sources",
                  "newPages"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "REVERSE"
                    ]
                  },
                  "operationId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  }
                },
                "required": [
                  "kind",
                  "operationId",
                  "idempotencyKey"
                ],
                "additionalProperties": false
              }
            ]
          },
          "reviewedPlanDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "confirmed": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "request",
          "reviewedPlanDigest",
          "confirmed"
        ],
        "additionalProperties": false
      },
      "FolderInstructionConfirmResponse": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "state": {
            "type": "string",
            "enum": [
              "QUIESCING",
              "STAGING",
              "VERIFIED",
              "COMMITTED",
              "VERIFIED_READBACK",
              "CANCELLED",
              "FAILED"
            ]
          },
          "planDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "visibilityCommitted": {
            "type": "boolean"
          },
          "readbackVerified": {
            "type": "boolean"
          },
          "quiesceReadyAt": {
            "type": "string",
            "format": "date-time"
          },
          "leaseExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "committedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time"
          },
          "requiresExplicitResume": {
            "type": "boolean"
          },
          "result": {
            "nullable": true,
            "type": "object",
            "properties": {
              "operationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "folderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "instructionSetId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "planDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ACTIVATE",
                  "APPEND",
                  "REVERSE"
                ]
              },
              "visibilityCommitted": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "readbackVerified": {
                "type": "boolean"
              },
              "destinationPages": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "pageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "checksum": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "sourcePageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "pageId",
                    "title",
                    "icon",
                    "sortOrder",
                    "contentSchemaVersion",
                    "parentPageId",
                    "checksum",
                    "sourcePageId"
                  ],
                  "additionalProperties": false
                }
              },
              "archivedPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "retainedSourcePageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "preservedFolderPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "revisions": {
                "maxItems": 501,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "scopeType": {
                      "type": "string",
                      "enum": [
                        "JOB",
                        "FOLDER"
                      ]
                    },
                    "scopeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "kind": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "scopeType",
                    "scopeId",
                    "revision",
                    "kind"
                  ],
                  "additionalProperties": false
                }
              },
              "reversalGuardDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "reversedOperationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "restoredPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              }
            },
            "required": [
              "operationId",
              "folderId",
              "instructionSetId",
              "planDigest",
              "kind",
              "visibilityCommitted",
              "readbackVerified",
              "destinationPages",
              "archivedPageIds",
              "retainedSourcePageIds",
              "preservedFolderPageIds",
              "revisions",
              "reversalGuardDigest"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "operationId",
          "folderId",
          "state",
          "planDigest",
          "visibilityCommitted",
          "readbackVerified",
          "quiesceReadyAt",
          "leaseExpiresAt",
          "committedAt",
          "requiresExplicitResume",
          "result"
        ],
        "additionalProperties": false
      },
      "FolderInstructionStatusResponse": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "state": {
            "type": "string",
            "enum": [
              "QUIESCING",
              "STAGING",
              "VERIFIED",
              "COMMITTED",
              "VERIFIED_READBACK",
              "CANCELLED",
              "FAILED"
            ]
          },
          "planDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "visibilityCommitted": {
            "type": "boolean"
          },
          "readbackVerified": {
            "type": "boolean"
          },
          "quiesceReadyAt": {
            "type": "string",
            "format": "date-time"
          },
          "leaseExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "committedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time"
          },
          "requiresExplicitResume": {
            "type": "boolean"
          },
          "result": {
            "nullable": true,
            "type": "object",
            "properties": {
              "operationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "folderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "instructionSetId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "planDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ACTIVATE",
                  "APPEND",
                  "REVERSE"
                ]
              },
              "visibilityCommitted": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "readbackVerified": {
                "type": "boolean"
              },
              "destinationPages": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "pageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "checksum": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "sourcePageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "pageId",
                    "title",
                    "icon",
                    "sortOrder",
                    "contentSchemaVersion",
                    "parentPageId",
                    "checksum",
                    "sourcePageId"
                  ],
                  "additionalProperties": false
                }
              },
              "archivedPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "retainedSourcePageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "preservedFolderPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "revisions": {
                "maxItems": 501,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "scopeType": {
                      "type": "string",
                      "enum": [
                        "JOB",
                        "FOLDER"
                      ]
                    },
                    "scopeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "kind": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "scopeType",
                    "scopeId",
                    "revision",
                    "kind"
                  ],
                  "additionalProperties": false
                }
              },
              "reversalGuardDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "reversedOperationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "restoredPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              }
            },
            "required": [
              "operationId",
              "folderId",
              "instructionSetId",
              "planDigest",
              "kind",
              "visibilityCommitted",
              "readbackVerified",
              "destinationPages",
              "archivedPageIds",
              "retainedSourcePageIds",
              "preservedFolderPageIds",
              "revisions",
              "reversalGuardDigest"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "operationId",
          "folderId",
          "state",
          "planDigest",
          "visibilityCommitted",
          "readbackVerified",
          "quiesceReadyAt",
          "leaseExpiresAt",
          "committedAt",
          "requiresExplicitResume",
          "result"
        ],
        "additionalProperties": false
      },
      "FolderInstructionApplyRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "FolderInstructionApplyResponse": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "state": {
            "type": "string",
            "enum": [
              "QUIESCING",
              "STAGING",
              "VERIFIED",
              "COMMITTED",
              "VERIFIED_READBACK",
              "CANCELLED",
              "FAILED"
            ]
          },
          "planDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "visibilityCommitted": {
            "type": "boolean"
          },
          "readbackVerified": {
            "type": "boolean"
          },
          "quiesceReadyAt": {
            "type": "string",
            "format": "date-time"
          },
          "leaseExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "committedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time"
          },
          "requiresExplicitResume": {
            "type": "boolean"
          },
          "result": {
            "nullable": true,
            "type": "object",
            "properties": {
              "operationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "folderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "instructionSetId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "planDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ACTIVATE",
                  "APPEND",
                  "REVERSE"
                ]
              },
              "visibilityCommitted": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "readbackVerified": {
                "type": "boolean"
              },
              "destinationPages": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "pageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "checksum": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "sourcePageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "pageId",
                    "title",
                    "icon",
                    "sortOrder",
                    "contentSchemaVersion",
                    "parentPageId",
                    "checksum",
                    "sourcePageId"
                  ],
                  "additionalProperties": false
                }
              },
              "archivedPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "retainedSourcePageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "preservedFolderPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "revisions": {
                "maxItems": 501,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "scopeType": {
                      "type": "string",
                      "enum": [
                        "JOB",
                        "FOLDER"
                      ]
                    },
                    "scopeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "kind": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "scopeType",
                    "scopeId",
                    "revision",
                    "kind"
                  ],
                  "additionalProperties": false
                }
              },
              "reversalGuardDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "reversedOperationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "restoredPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              }
            },
            "required": [
              "operationId",
              "folderId",
              "instructionSetId",
              "planDigest",
              "kind",
              "visibilityCommitted",
              "readbackVerified",
              "destinationPages",
              "archivedPageIds",
              "retainedSourcePageIds",
              "preservedFolderPageIds",
              "revisions",
              "reversalGuardDigest"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "operationId",
          "folderId",
          "state",
          "planDigest",
          "visibilityCommitted",
          "readbackVerified",
          "quiesceReadyAt",
          "leaseExpiresAt",
          "committedAt",
          "requiresExplicitResume",
          "result"
        ],
        "additionalProperties": false
      },
      "FolderInstructionCancelRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "FolderInstructionCancelResponse": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "state": {
            "type": "string",
            "enum": [
              "QUIESCING",
              "STAGING",
              "VERIFIED",
              "COMMITTED",
              "VERIFIED_READBACK",
              "CANCELLED",
              "FAILED"
            ]
          },
          "planDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "visibilityCommitted": {
            "type": "boolean"
          },
          "readbackVerified": {
            "type": "boolean"
          },
          "quiesceReadyAt": {
            "type": "string",
            "format": "date-time"
          },
          "leaseExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "committedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time"
          },
          "requiresExplicitResume": {
            "type": "boolean"
          },
          "result": {
            "nullable": true,
            "type": "object",
            "properties": {
              "operationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "folderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "instructionSetId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "planDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ACTIVATE",
                  "APPEND",
                  "REVERSE"
                ]
              },
              "visibilityCommitted": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "readbackVerified": {
                "type": "boolean"
              },
              "destinationPages": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "pageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "checksum": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "sourcePageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "pageId",
                    "title",
                    "icon",
                    "sortOrder",
                    "contentSchemaVersion",
                    "parentPageId",
                    "checksum",
                    "sourcePageId"
                  ],
                  "additionalProperties": false
                }
              },
              "archivedPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "retainedSourcePageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "preservedFolderPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "revisions": {
                "maxItems": 501,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "scopeType": {
                      "type": "string",
                      "enum": [
                        "JOB",
                        "FOLDER"
                      ]
                    },
                    "scopeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "kind": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "scopeType",
                    "scopeId",
                    "revision",
                    "kind"
                  ],
                  "additionalProperties": false
                }
              },
              "reversalGuardDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "reversedOperationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "restoredPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              }
            },
            "required": [
              "operationId",
              "folderId",
              "instructionSetId",
              "planDigest",
              "kind",
              "visibilityCommitted",
              "readbackVerified",
              "destinationPages",
              "archivedPageIds",
              "retainedSourcePageIds",
              "preservedFolderPageIds",
              "revisions",
              "reversalGuardDigest"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "operationId",
          "folderId",
          "state",
          "planDigest",
          "visibilityCommitted",
          "readbackVerified",
          "quiesceReadyAt",
          "leaseExpiresAt",
          "committedAt",
          "requiresExplicitResume",
          "result"
        ],
        "additionalProperties": false
      },
      "FolderInstructionResumeRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "FolderInstructionResumeResponse": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "state": {
            "type": "string",
            "enum": [
              "QUIESCING",
              "STAGING",
              "VERIFIED",
              "COMMITTED",
              "VERIFIED_READBACK",
              "CANCELLED",
              "FAILED"
            ]
          },
          "planDigest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "visibilityCommitted": {
            "type": "boolean"
          },
          "readbackVerified": {
            "type": "boolean"
          },
          "quiesceReadyAt": {
            "type": "string",
            "format": "date-time"
          },
          "leaseExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "committedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time"
          },
          "requiresExplicitResume": {
            "type": "boolean"
          },
          "result": {
            "nullable": true,
            "type": "object",
            "properties": {
              "operationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "folderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "instructionSetId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "planDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ACTIVATE",
                  "APPEND",
                  "REVERSE"
                ]
              },
              "visibilityCommitted": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "readbackVerified": {
                "type": "boolean"
              },
              "destinationPages": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "pageId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "checksum": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "sourcePageId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "pageId",
                    "title",
                    "icon",
                    "sortOrder",
                    "contentSchemaVersion",
                    "parentPageId",
                    "checksum",
                    "sourcePageId"
                  ],
                  "additionalProperties": false
                }
              },
              "archivedPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "retainedSourcePageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "preservedFolderPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "revisions": {
                "maxItems": 501,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "scopeType": {
                      "type": "string",
                      "enum": [
                        "JOB",
                        "FOLDER"
                      ]
                    },
                    "scopeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "kind": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "scopeType",
                    "scopeId",
                    "revision",
                    "kind"
                  ],
                  "additionalProperties": false
                }
              },
              "reversalGuardDigest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "reversedOperationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "restoredPageIds": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              }
            },
            "required": [
              "operationId",
              "folderId",
              "instructionSetId",
              "planDigest",
              "kind",
              "visibilityCommitted",
              "readbackVerified",
              "destinationPages",
              "archivedPageIds",
              "retainedSourcePageIds",
              "preservedFolderPageIds",
              "revisions",
              "reversalGuardDigest"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "operationId",
          "folderId",
          "state",
          "planDigest",
          "visibilityCommitted",
          "readbackVerified",
          "quiesceReadyAt",
          "leaseExpiresAt",
          "committedAt",
          "requiresExplicitResume",
          "result"
        ],
        "additionalProperties": false
      },
      "FolderInstructionRecoveryResponse": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "enum": [
              "opentrain-folder-instructions-recovery/1"
            ]
          },
          "folderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "operationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "visibilityCommitted": {
            "type": "boolean"
          },
          "preservationComplete": {
            "type": "boolean"
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "pages": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pageId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "destinationPageId": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "checkpointId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "sourceScope": {
                  "type": "object",
                  "properties": {
                    "scopeType": {
                      "type": "string",
                      "enum": [
                        "JOB",
                        "FOLDER"
                      ]
                    },
                    "jobId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "folderId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "scopeType",
                    "jobId",
                    "folderId"
                  ],
                  "additionalProperties": false
                },
                "title": {
                  "type": "string"
                },
                "icon": {
                  "nullable": true,
                  "type": "string"
                },
                "parentPageId": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "sortOrder": {
                  "type": "integer"
                },
                "contentSchemaVersion": {
                  "type": "integer"
                },
                "originallyArchived": {
                  "type": "boolean"
                },
                "currentlyArchived": {
                  "type": "boolean"
                },
                "checksum": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "content": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "doc"
                      ]
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "marks": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "attrs": {
                                  "type": "object",
                                  "additionalProperties": {}
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "content": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/FolderInstructionRecoveryResponse/properties/pages/items/properties/content/properties/content/items"
                            }
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "type",
                    "content"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "pageId",
                "destinationPageId",
                "checkpointId",
                "sourceScope",
                "title",
                "icon",
                "parentPageId",
                "sortOrder",
                "contentSchemaVersion",
                "originallyArchived",
                "currentlyArchived",
                "checksum",
                "content"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "schemaVersion",
          "folderId",
          "operationId",
          "visibilityCommitted",
          "preservationComplete",
          "writesApplied",
          "pages"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPagesResponse": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "hasInstructions": {
            "type": "boolean"
          },
          "pages": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "instructionSetId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "parentPageId": {
                  "nullable": true,
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "title": {
                  "type": "string"
                },
                "icon": {
                  "nullable": true,
                  "type": "string"
                },
                "shareUrl": {
                  "type": "string"
                },
                "sortOrder": {
                  "type": "integer"
                },
                "contentSchemaVersion": {
                  "type": "integer",
                  "minimum": 0
                },
                "editable": {
                  "type": "boolean"
                },
                "inherited": {
                  "type": "boolean"
                },
                "managedAt": {
                  "type": "string",
                  "enum": [
                    "FOLDER"
                  ]
                },
                "children": {
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                      },
                      "instructionSetId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                      },
                      "parentPageId": {
                        "nullable": true,
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                      },
                      "title": {
                        "type": "string"
                      },
                      "icon": {
                        "nullable": true,
                        "type": "string"
                      },
                      "shareUrl": {
                        "type": "string"
                      },
                      "sortOrder": {
                        "type": "integer"
                      },
                      "contentSchemaVersion": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "editable": {
                        "type": "boolean"
                      },
                      "inherited": {
                        "type": "boolean"
                      },
                      "managedAt": {
                        "type": "string",
                        "enum": [
                          "FOLDER"
                        ]
                      },
                      "children": {
                        "maxItems": 0,
                        "type": "array",
                        "items": {
                          "not": {}
                        }
                      }
                    },
                    "required": [
                      "id",
                      "instructionSetId",
                      "parentPageId",
                      "title",
                      "icon",
                      "shareUrl",
                      "sortOrder",
                      "contentSchemaVersion",
                      "editable",
                      "inherited",
                      "managedAt",
                      "children"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "instructionSetId",
                "parentPageId",
                "title",
                "icon",
                "shareUrl",
                "sortOrder",
                "contentSchemaVersion",
                "editable",
                "inherited",
                "managedAt",
                "children"
              ],
              "additionalProperties": false
            }
          },
          "delivery": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string"
              },
              "writesSupported": {
                "type": "boolean"
              }
            },
            "required": [
              "mode",
              "writesSupported"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "location",
          "hasInstructions",
          "pages",
          "delivery"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringReadPageResponse": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "page": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "instructionSetId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "parentPageId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "title": {
                "type": "string"
              },
              "icon": {
                "nullable": true,
                "type": "string"
              },
              "shareUrl": {
                "type": "string"
              },
              "sortOrder": {
                "type": "integer"
              },
              "contentSchemaVersion": {
                "type": "integer",
                "minimum": 0
              },
              "editable": {
                "type": "boolean"
              },
              "inherited": {
                "type": "boolean"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "children": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "instructionSetId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "editable": {
                      "type": "boolean"
                    },
                    "inherited": {
                      "type": "boolean"
                    },
                    "managedAt": {
                      "type": "string",
                      "enum": [
                        "FOLDER"
                      ]
                    },
                    "children": {
                      "maxItems": 0,
                      "type": "array",
                      "items": {
                        "not": {}
                      }
                    }
                  },
                  "required": [
                    "id",
                    "instructionSetId",
                    "parentPageId",
                    "title",
                    "icon",
                    "shareUrl",
                    "sortOrder",
                    "contentSchemaVersion",
                    "editable",
                    "inherited",
                    "managedAt",
                    "children"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "instructionSetId",
              "parentPageId",
              "title",
              "icon",
              "shareUrl",
              "sortOrder",
              "contentSchemaVersion",
              "editable",
              "inherited",
              "managedAt",
              "children"
            ],
            "additionalProperties": false
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringReadPageResponse/properties/content/properties/doc/properties/content/items"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "location",
          "page",
          "content"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPreviewResponse": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringPreviewResponse/properties/content/properties/doc/properties/content/items"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          },
          "renderedHtml": {
            "type": "string"
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "ERROR",
                    "WARNING",
                    "INFO"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "details": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "required": [
                "code",
                "severity",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "canApply": {
            "type": "boolean"
          },
          "contentSchemaVersion": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "location",
          "content",
          "renderedHtml",
          "writesApplied"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPreviewRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "doc"
                ]
              },
              "content": {
                "maxItems": 100000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "attrs": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "marks": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "text": {
                      "type": "string"
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FolderInstructionAuthoringPreviewRequest/properties/content/properties/content/items"
                      }
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "type",
              "content"
            ],
            "additionalProperties": false
          },
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "contentSchemaVersion": {
            "type": "integer"
          }
        },
        "required": [
          "content"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPreflightResponse": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "canApply": {
            "type": "boolean"
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "ERROR",
                    "WARNING",
                    "INFO"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "details": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "required": [
                "code",
                "severity",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "baseTreeChecksum": {
            "type": "string"
          },
          "resultingTreeChecksum": {
            "type": "string"
          },
          "planDigest": {
            "type": "string"
          },
          "preflightToken": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "operation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "create"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "parentPageId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "beforePageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "afterPageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "doc"
                        ]
                      },
                      "content": {
                        "maxItems": 100000,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100
                            },
                            "attrs": {
                              "type": "object",
                              "additionalProperties": {}
                            },
                            "marks": {
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  },
                                  "attrs": {
                                    "type": "object",
                                    "additionalProperties": {}
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "text": {
                              "type": "string"
                            },
                            "content": {
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "type",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  "contentSchemaVersion": {
                    "type": "integer"
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  }
                },
                "required": [
                  "type",
                  "title",
                  "idempotencyKey"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "replace"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "doc"
                        ]
                      },
                      "content": {
                        "maxItems": 100000,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse/properties/operation/anyOf/0/properties/content/properties/content/items"
                        }
                      }
                    },
                    "required": [
                      "type",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  "expectedChecksum": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  },
                  "confirmReplace": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "type",
                  "pageId",
                  "content",
                  "expectedChecksum",
                  "confirmReplace"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "patch"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "expectedChecksum": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  },
                  "operations": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "replace_node"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "node": {
                              "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse/properties/operation/anyOf/0/properties/content/properties/content/items"
                            },
                            "expectedChecksum": {
                              "type": "string",
                              "pattern": "^[a-fA-F0-9]{64}$"
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "node"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "insert_before"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "nodes": {
                              "minItems": 1,
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "nodes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "insert_after"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "nodes": {
                              "minItems": 1,
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "nodes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "append_children"
                              ]
                            },
                            "nodeId": {
                              "nullable": true,
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "nodes": {
                              "minItems": 1,
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "nodes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "set_attrs"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "attrs": {
                              "type": "object",
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "attrs"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "delete_node"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "expectedChecksum": {
                              "type": "string",
                              "pattern": "^[a-fA-F0-9]{64}$"
                            }
                          },
                          "required": [
                            "op",
                            "nodeId"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "type",
                  "pageId",
                  "expectedChecksum",
                  "operations"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "metadata"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "parentPageId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "up",
                      "down"
                    ]
                  },
                  "icon": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  }
                },
                "required": [
                  "type",
                  "pageId"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "archive"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "confirmArchive": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "type",
                  "pageId",
                  "confirmArchive"
                ],
                "additionalProperties": false
              }
            ]
          },
          "resultingPages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "instructionSetId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "parentPageId": {
                  "nullable": true,
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "title": {
                  "type": "string"
                },
                "icon": {
                  "nullable": true,
                  "type": "string"
                },
                "shareUrl": {
                  "type": "string"
                },
                "sortOrder": {
                  "type": "integer"
                },
                "contentSchemaVersion": {
                  "type": "integer",
                  "minimum": 0
                },
                "editable": {
                  "type": "boolean"
                },
                "inherited": {
                  "type": "boolean"
                },
                "managedAt": {
                  "type": "string",
                  "enum": [
                    "FOLDER"
                  ]
                },
                "children": {
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                      },
                      "instructionSetId": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                      },
                      "parentPageId": {
                        "nullable": true,
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                      },
                      "title": {
                        "type": "string"
                      },
                      "icon": {
                        "nullable": true,
                        "type": "string"
                      },
                      "shareUrl": {
                        "type": "string"
                      },
                      "sortOrder": {
                        "type": "integer"
                      },
                      "contentSchemaVersion": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "editable": {
                        "type": "boolean"
                      },
                      "inherited": {
                        "type": "boolean"
                      },
                      "managedAt": {
                        "type": "string",
                        "enum": [
                          "FOLDER"
                        ]
                      },
                      "children": {
                        "maxItems": 0,
                        "type": "array",
                        "items": {
                          "not": {}
                        }
                      }
                    },
                    "required": [
                      "id",
                      "instructionSetId",
                      "parentPageId",
                      "title",
                      "icon",
                      "shareUrl",
                      "sortOrder",
                      "contentSchemaVersion",
                      "editable",
                      "inherited",
                      "managedAt",
                      "children"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "instructionSetId",
                "parentPageId",
                "title",
                "icon",
                "shareUrl",
                "sortOrder",
                "contentSchemaVersion",
                "editable",
                "inherited",
                "managedAt",
                "children"
              ],
              "additionalProperties": false
            }
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightResponse/properties/operation/anyOf/0/properties/content/properties/content/items"
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          },
          "renderedHtml": {
            "type": "string"
          }
        },
        "required": [
          "location",
          "canApply",
          "findings",
          "baseTreeChecksum",
          "resultingTreeChecksum",
          "planDigest",
          "preflightToken",
          "expiresAt",
          "writesApplied",
          "operation",
          "resultingPages"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPreflightRequest": {
        "type": "object",
        "properties": {
          "operation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "create"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "parentPageId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "beforePageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "afterPageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "doc"
                        ]
                      },
                      "content": {
                        "maxItems": 100000,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100
                            },
                            "attrs": {
                              "type": "object",
                              "additionalProperties": {}
                            },
                            "marks": {
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  },
                                  "attrs": {
                                    "type": "object",
                                    "additionalProperties": {}
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "text": {
                              "type": "string"
                            },
                            "content": {
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightRequest/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "type",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  "contentSchemaVersion": {
                    "type": "integer"
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  }
                },
                "required": [
                  "type",
                  "title",
                  "idempotencyKey"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "replace"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "doc"
                        ]
                      },
                      "content": {
                        "maxItems": 100000,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightRequest/properties/operation/anyOf/0/properties/content/properties/content/items"
                        }
                      }
                    },
                    "required": [
                      "type",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  "expectedChecksum": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  },
                  "confirmReplace": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "type",
                  "pageId",
                  "content",
                  "expectedChecksum",
                  "confirmReplace"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "patch"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "expectedChecksum": {
                    "type": "string",
                    "pattern": "^[a-fA-F0-9]{64}$"
                  },
                  "operations": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "replace_node"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "node": {
                              "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightRequest/properties/operation/anyOf/0/properties/content/properties/content/items"
                            },
                            "expectedChecksum": {
                              "type": "string",
                              "pattern": "^[a-fA-F0-9]{64}$"
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "node"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "insert_before"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "nodes": {
                              "minItems": 1,
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightRequest/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "nodes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "insert_after"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "nodes": {
                              "minItems": 1,
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightRequest/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "nodes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "append_children"
                              ]
                            },
                            "nodeId": {
                              "nullable": true,
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "nodes": {
                              "minItems": 1,
                              "maxItems": 100000,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/FolderInstructionAuthoringPreflightRequest/properties/operation/anyOf/0/properties/content/properties/content/items"
                              }
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "nodes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "set_attrs"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "attrs": {
                              "type": "object",
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "op",
                            "nodeId",
                            "attrs"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "enum": [
                                "delete_node"
                              ]
                            },
                            "nodeId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "expectedChecksum": {
                              "type": "string",
                              "pattern": "^[a-fA-F0-9]{64}$"
                            }
                          },
                          "required": [
                            "op",
                            "nodeId"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "type",
                  "pageId",
                  "expectedChecksum",
                  "operations"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "metadata"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "parentPageId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "up",
                      "down"
                    ]
                  },
                  "icon": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  }
                },
                "required": [
                  "type",
                  "pageId"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "archive"
                    ]
                  },
                  "pageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "confirmArchive": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "type",
                  "pageId",
                  "confirmArchive"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "operation"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringTreePreflightResponse": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "canApply": {
            "type": "boolean"
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "ERROR",
                    "WARNING",
                    "INFO"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "details": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "required": [
                "code",
                "severity",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "baseTreeChecksum": {
            "type": "string"
          },
          "resultingTreeChecksum": {
            "type": "string"
          },
          "planDigest": {
            "type": "string"
          },
          "preflightToken": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "normalizedPages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "pageId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "icon": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                },
                "parentRef": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "position": {
                  "type": "integer",
                  "minimum": 0
                },
                "content": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "doc"
                      ]
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "marks": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "attrs": {
                                  "type": "object",
                                  "additionalProperties": {}
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "content": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/FolderInstructionAuthoringTreePreflightResponse/properties/normalizedPages/items/properties/content/properties/content/items"
                            }
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "type",
                    "content"
                  ],
                  "additionalProperties": false
                },
                "expectedChecksum": {
                  "type": "string",
                  "pattern": "^[a-fA-F0-9]{64}$"
                },
                "contentSchemaVersion": {
                  "type": "integer"
                },
                "checksum": {
                  "type": "string",
                  "pattern": "^[a-fA-F0-9]{64}$"
                }
              },
              "required": [
                "ref",
                "title",
                "parentRef",
                "position",
                "content",
                "checksum"
              ],
              "additionalProperties": false
            }
          },
          "archivedPageIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          },
          "atomicVisibility": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "location",
          "canApply",
          "findings",
          "baseTreeChecksum",
          "resultingTreeChecksum",
          "planDigest",
          "preflightToken",
          "expiresAt",
          "writesApplied",
          "normalizedPages",
          "archivedPageIds",
          "atomicVisibility"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringTreePreflightRequest": {
        "type": "object",
        "properties": {
          "expectedTreeChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "pages": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "pageId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "icon": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                },
                "parentRef": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "position": {
                  "type": "integer",
                  "minimum": 0
                },
                "content": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "doc"
                      ]
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "marks": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "attrs": {
                                  "type": "object",
                                  "additionalProperties": {}
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "content": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/FolderInstructionAuthoringTreePreflightRequest/properties/pages/items/properties/content/properties/content/items"
                            }
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "type",
                    "content"
                  ],
                  "additionalProperties": false
                },
                "expectedChecksum": {
                  "type": "string",
                  "pattern": "^[a-fA-F0-9]{64}$"
                },
                "contentSchemaVersion": {
                  "type": "integer"
                }
              },
              "required": [
                "ref",
                "title",
                "parentRef",
                "position",
                "content"
              ],
              "additionalProperties": false
            }
          },
          "archivedPageIds": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "confirmTreeReplace": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          }
        },
        "required": [
          "expectedTreeChecksum",
          "pages",
          "confirmTreeReplace",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringTreeApplyResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "treeChecksum": {
            "type": "string"
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string"
                },
                "pageId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "title": {
                  "type": "string"
                },
                "parentPageId": {
                  "nullable": true,
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "position": {
                  "type": "integer",
                  "minimum": 0
                },
                "checksum": {
                  "type": "string",
                  "pattern": "^[a-fA-F0-9]{64}$"
                }
              },
              "required": [
                "ref",
                "pageId",
                "title",
                "parentPageId",
                "position",
                "checksum"
              ],
              "additionalProperties": false
            }
          },
          "archivedPageIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            }
          },
          "atomicVisibility": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "converged": {
            "type": "boolean"
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "location",
          "treeChecksum",
          "pages",
          "archivedPageIds",
          "atomicVisibility",
          "writesApplied"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringTreeApplyRequest": {
        "type": "object",
        "properties": {
          "expectedTreeChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "pages": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "pageId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "icon": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                },
                "parentRef": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "position": {
                  "type": "integer",
                  "minimum": 0
                },
                "content": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "doc"
                      ]
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "marks": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "attrs": {
                                  "type": "object",
                                  "additionalProperties": {}
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "content": {
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/FolderInstructionAuthoringTreeApplyRequest/properties/pages/items/properties/content/properties/content/items"
                            }
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "type",
                    "content"
                  ],
                  "additionalProperties": false
                },
                "expectedChecksum": {
                  "type": "string",
                  "pattern": "^[a-fA-F0-9]{64}$"
                },
                "contentSchemaVersion": {
                  "type": "integer"
                }
              },
              "required": [
                "ref",
                "title",
                "parentRef",
                "position",
                "content"
              ],
              "additionalProperties": false
            }
          },
          "archivedPageIds": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "confirmTreeReplace": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "preflightToken": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "expectedTreeChecksum",
          "pages",
          "archivedPageIds",
          "confirmTreeReplace",
          "idempotencyKey",
          "preflightToken",
          "confirmLive"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringCreatePageResponse": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "page": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "instructionSetId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "parentPageId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "title": {
                "type": "string"
              },
              "icon": {
                "nullable": true,
                "type": "string"
              },
              "shareUrl": {
                "type": "string"
              },
              "sortOrder": {
                "type": "integer"
              },
              "contentSchemaVersion": {
                "type": "integer",
                "minimum": 0
              },
              "editable": {
                "type": "boolean"
              },
              "inherited": {
                "type": "boolean"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "children": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "instructionSetId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "editable": {
                      "type": "boolean"
                    },
                    "inherited": {
                      "type": "boolean"
                    },
                    "managedAt": {
                      "type": "string",
                      "enum": [
                        "FOLDER"
                      ]
                    },
                    "children": {
                      "maxItems": 0,
                      "type": "array",
                      "items": {
                        "not": {}
                      }
                    }
                  },
                  "required": [
                    "id",
                    "instructionSetId",
                    "parentPageId",
                    "title",
                    "icon",
                    "shareUrl",
                    "sortOrder",
                    "contentSchemaVersion",
                    "editable",
                    "inherited",
                    "managedAt",
                    "children"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "instructionSetId",
              "parentPageId",
              "title",
              "icon",
              "shareUrl",
              "sortOrder",
              "contentSchemaVersion",
              "editable",
              "inherited",
              "managedAt",
              "children"
            ],
            "additionalProperties": false
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringCreatePageResponse/properties/content/properties/doc/properties/content/items"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "location",
          "page",
          "content",
          "replayed"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringCreatePageRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "parentPageId": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "beforePageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "afterPageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "position": {
            "type": "integer",
            "minimum": 0
          },
          "content": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "doc"
                ]
              },
              "content": {
                "maxItems": 100000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "attrs": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "marks": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "text": {
                      "type": "string"
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FolderInstructionAuthoringCreatePageRequest/properties/content/properties/content/items"
                      }
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "type",
              "content"
            ],
            "additionalProperties": false
          },
          "contentSchemaVersion": {
            "type": "integer"
          },
          "contentSource": {
            "type": "string",
            "enum": [
              "DOCX_IMPORT"
            ]
          },
          "preflightToken": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "title",
          "preflightToken",
          "confirmLive"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringReplacePageResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "page": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "instructionSetId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "parentPageId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "title": {
                "type": "string"
              },
              "icon": {
                "nullable": true,
                "type": "string"
              },
              "shareUrl": {
                "type": "string"
              },
              "sortOrder": {
                "type": "integer"
              },
              "contentSchemaVersion": {
                "type": "integer",
                "minimum": 0
              },
              "editable": {
                "type": "boolean"
              },
              "inherited": {
                "type": "boolean"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "children": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "instructionSetId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "editable": {
                      "type": "boolean"
                    },
                    "inherited": {
                      "type": "boolean"
                    },
                    "managedAt": {
                      "type": "string",
                      "enum": [
                        "FOLDER"
                      ]
                    },
                    "children": {
                      "maxItems": 0,
                      "type": "array",
                      "items": {
                        "not": {}
                      }
                    }
                  },
                  "required": [
                    "id",
                    "instructionSetId",
                    "parentPageId",
                    "title",
                    "icon",
                    "shareUrl",
                    "sortOrder",
                    "contentSchemaVersion",
                    "editable",
                    "inherited",
                    "managedAt",
                    "children"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "instructionSetId",
              "parentPageId",
              "title",
              "icon",
              "shareUrl",
              "sortOrder",
              "contentSchemaVersion",
              "editable",
              "inherited",
              "managedAt",
              "children"
            ],
            "additionalProperties": false
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringReplacePageResponse/properties/content/properties/doc/properties/content/items"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "location",
          "page"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringReplacePageRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "doc"
                ]
              },
              "content": {
                "maxItems": 100000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "attrs": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "marks": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "text": {
                      "type": "string"
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FolderInstructionAuthoringReplacePageRequest/properties/content/properties/content/items"
                      }
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "type",
              "content"
            ],
            "additionalProperties": false
          },
          "expectedChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "preflightToken": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "confirmReplace": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "content",
          "expectedChecksum",
          "preflightToken",
          "confirmReplace",
          "confirmLive"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPatchPageResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "page": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "instructionSetId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "parentPageId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "title": {
                "type": "string"
              },
              "icon": {
                "nullable": true,
                "type": "string"
              },
              "shareUrl": {
                "type": "string"
              },
              "sortOrder": {
                "type": "integer"
              },
              "contentSchemaVersion": {
                "type": "integer",
                "minimum": 0
              },
              "editable": {
                "type": "boolean"
              },
              "inherited": {
                "type": "boolean"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "children": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "instructionSetId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "editable": {
                      "type": "boolean"
                    },
                    "inherited": {
                      "type": "boolean"
                    },
                    "managedAt": {
                      "type": "string",
                      "enum": [
                        "FOLDER"
                      ]
                    },
                    "children": {
                      "maxItems": 0,
                      "type": "array",
                      "items": {
                        "not": {}
                      }
                    }
                  },
                  "required": [
                    "id",
                    "instructionSetId",
                    "parentPageId",
                    "title",
                    "icon",
                    "shareUrl",
                    "sortOrder",
                    "contentSchemaVersion",
                    "editable",
                    "inherited",
                    "managedAt",
                    "children"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "instructionSetId",
              "parentPageId",
              "title",
              "icon",
              "shareUrl",
              "sortOrder",
              "contentSchemaVersion",
              "editable",
              "inherited",
              "managedAt",
              "children"
            ],
            "additionalProperties": false
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringPatchPageResponse/properties/content/properties/doc/properties/content/items"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "location",
          "page"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPatchPageRequest": {
        "type": "object",
        "properties": {
          "expectedChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "operations": {
            "minItems": 1,
            "maxItems": 500,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "enum": [
                        "replace_node"
                      ]
                    },
                    "nodeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "node": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringPatchPageRequest/properties/operations/items/anyOf/0/properties/node"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "expectedChecksum": {
                      "type": "string",
                      "pattern": "^[a-fA-F0-9]{64}$"
                    }
                  },
                  "required": [
                    "op",
                    "nodeId",
                    "node"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "enum": [
                        "insert_before"
                      ]
                    },
                    "nodeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "nodes": {
                      "minItems": 1,
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FolderInstructionAuthoringPatchPageRequest/properties/operations/items/anyOf/0/properties/node"
                      }
                    }
                  },
                  "required": [
                    "op",
                    "nodeId",
                    "nodes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "enum": [
                        "insert_after"
                      ]
                    },
                    "nodeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "nodes": {
                      "minItems": 1,
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FolderInstructionAuthoringPatchPageRequest/properties/operations/items/anyOf/0/properties/node"
                      }
                    }
                  },
                  "required": [
                    "op",
                    "nodeId",
                    "nodes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "enum": [
                        "append_children"
                      ]
                    },
                    "nodeId": {
                      "nullable": true,
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "nodes": {
                      "minItems": 1,
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FolderInstructionAuthoringPatchPageRequest/properties/operations/items/anyOf/0/properties/node"
                      }
                    }
                  },
                  "required": [
                    "op",
                    "nodeId",
                    "nodes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "enum": [
                        "set_attrs"
                      ]
                    },
                    "nodeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "attrs": {
                      "type": "object",
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "op",
                    "nodeId",
                    "attrs"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "enum": [
                        "delete_node"
                      ]
                    },
                    "nodeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "expectedChecksum": {
                      "type": "string",
                      "pattern": "^[a-fA-F0-9]{64}$"
                    }
                  },
                  "required": [
                    "op",
                    "nodeId"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "preflightToken": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "expectedChecksum",
          "operations",
          "preflightToken",
          "confirmLive"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringUpdatePageResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "page": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "instructionSetId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "parentPageId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "title": {
                "type": "string"
              },
              "icon": {
                "nullable": true,
                "type": "string"
              },
              "shareUrl": {
                "type": "string"
              },
              "sortOrder": {
                "type": "integer"
              },
              "contentSchemaVersion": {
                "type": "integer",
                "minimum": 0
              },
              "editable": {
                "type": "boolean"
              },
              "inherited": {
                "type": "boolean"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "children": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "instructionSetId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "editable": {
                      "type": "boolean"
                    },
                    "inherited": {
                      "type": "boolean"
                    },
                    "managedAt": {
                      "type": "string",
                      "enum": [
                        "FOLDER"
                      ]
                    },
                    "children": {
                      "maxItems": 0,
                      "type": "array",
                      "items": {
                        "not": {}
                      }
                    }
                  },
                  "required": [
                    "id",
                    "instructionSetId",
                    "parentPageId",
                    "title",
                    "icon",
                    "shareUrl",
                    "sortOrder",
                    "contentSchemaVersion",
                    "editable",
                    "inherited",
                    "managedAt",
                    "children"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "instructionSetId",
              "parentPageId",
              "title",
              "icon",
              "shareUrl",
              "sortOrder",
              "contentSchemaVersion",
              "editable",
              "inherited",
              "managedAt",
              "children"
            ],
            "additionalProperties": false
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringUpdatePageResponse/properties/content/properties/doc/properties/content/items"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "location",
          "page"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringUpdatePageRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "parentPageId": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "direction": {
            "type": "string",
            "enum": [
              "up",
              "down"
            ]
          },
          "icon": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "preflightToken": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "preflightToken",
          "confirmLive"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringArchivePageResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "archivedPageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          }
        },
        "required": [
          "ok",
          "location",
          "archivedPageId"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringArchivePageRequest": {
        "type": "object",
        "properties": {
          "preflightToken": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "confirmArchive": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "preflightToken",
          "confirmArchive",
          "confirmLive"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPageLinkResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "title": {
            "type": "string"
          },
          "shareUrl": {
            "type": "string"
          },
          "anchorId": {
            "nullable": true,
            "type": "string"
          },
          "anchorUrl": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "pageId",
          "title",
          "shareUrl",
          "anchorId",
          "anchorUrl"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringVerifyResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "storageWriteAccepted": {
            "type": "string",
            "nullable": true,
            "enum": [
              null
            ]
          },
          "restReadBackVerified": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "checksumMatched": {
            "type": "string",
            "nullable": true,
            "enum": [
              null
            ]
          },
          "collaborationSyncVerified": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "browserRenderVerified": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "employerUrl": {
            "type": "string"
          },
          "treeChecksum": {
            "type": "string"
          },
          "pageCount": {
            "type": "integer",
            "minimum": 0
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "ERROR",
                    "WARNING",
                    "INFO"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "details": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "required": [
                "code",
                "severity",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pageId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "title": {
                  "type": "string"
                },
                "checksum": {
                  "type": "string",
                  "pattern": "^[a-fA-F0-9]{64}$"
                },
                "nodeCount": {
                  "type": "integer",
                  "minimum": 0
                },
                "stableNodeIdCount": {
                  "type": "integer",
                  "minimum": 0
                },
                "imageUrls": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "renderedHtmlValid": {
                  "type": "boolean"
                },
                "findings": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "severity": {
                        "type": "string",
                        "enum": [
                          "ERROR",
                          "WARNING",
                          "INFO"
                        ]
                      },
                      "message": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string"
                      },
                      "details": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "code",
                      "severity",
                      "message"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "pageId",
                "title",
                "checksum",
                "nodeCount",
                "stableNodeIdCount",
                "imageUrls",
                "renderedHtmlValid",
                "findings"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "ok",
          "storageWriteAccepted",
          "restReadBackVerified",
          "checksumMatched",
          "collaborationSyncVerified",
          "browserRenderVerified",
          "canonicalSource",
          "employerUrl",
          "treeChecksum",
          "pageCount",
          "findings",
          "pages"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringSearchResponse": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "query": {
            "type": "string"
          },
          "variant": {
            "type": "string",
            "enum": [
              "DRAFT"
            ]
          },
          "scopes": {
            "minItems": 1,
            "maxItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scopeType": {
                  "type": "string",
                  "enum": [
                    "FOLDER"
                  ]
                },
                "scopeId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                }
              },
              "required": [
                "scopeType",
                "scopeId"
              ],
              "additionalProperties": false
            }
          },
          "pages": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pageId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "title": {
                  "type": "string"
                },
                "breadcrumb": {
                  "type": "string"
                },
                "scopeType": {
                  "type": "string",
                  "enum": [
                    "FOLDER"
                  ]
                },
                "shareUrl": {
                  "nullable": true,
                  "type": "string"
                },
                "totalHits": {
                  "type": "integer",
                  "minimum": 0
                },
                "hits": {
                  "maxItems": 5,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "blockId": {
                        "type": "string"
                      },
                      "anchorId": {
                        "nullable": true,
                        "type": "string"
                      },
                      "headingAncestorText": {
                        "nullable": true,
                        "type": "string"
                      },
                      "blockOrdinal": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "isPageTitleHit": {
                        "type": "boolean"
                      },
                      "snippets": {
                        "maxItems": 5,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "matchRanges": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "start": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "end": {
                                    "type": "integer",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "start",
                                  "end"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "leadingEllipsis": {
                              "type": "boolean"
                            },
                            "trailingEllipsis": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "text",
                            "matchRanges",
                            "leadingEllipsis",
                            "trailingEllipsis"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "rank": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "blockId",
                      "anchorId",
                      "headingAncestorText",
                      "blockOrdinal",
                      "isPageTitleHit",
                      "snippets",
                      "rank"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "pageId",
                "title",
                "breadcrumb",
                "scopeType",
                "shareUrl",
                "totalHits",
                "hits"
              ],
              "additionalProperties": false
            }
          },
          "totalBlockHits": {
            "type": "integer",
            "minimum": 0
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0
          },
          "truncated": {
            "type": "boolean"
          },
          "windowRows": {
            "type": "integer",
            "minimum": 0
          },
          "usedTrigramFallback": {
            "type": "boolean"
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "location",
          "query",
          "variant",
          "scopes",
          "pages",
          "totalBlockHits",
          "totalPages",
          "truncated",
          "windowRows",
          "usedTrigramFallback",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringVisualReviewResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "employerUrl": {
            "type": "string"
          },
          "reviewSurface": {
            "type": "string",
            "enum": [
              "EMPLOYER_FOLDER_INSTRUCTIONS_TAB"
            ]
          },
          "requiresAuthenticatedEmployerSession": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "workerCoverage": {
            "type": "object",
            "properties": {
              "included": {
                "type": "boolean",
                "enum": [
                  false
                ]
              },
              "reason": {
                "type": "string"
              },
              "requirement": {
                "type": "string"
              }
            },
            "required": [
              "included",
              "reason",
              "requirement"
            ],
            "additionalProperties": false
          },
          "generatedAt": {
            "type": "string"
          },
          "treeChecksum": {
            "type": "string"
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pageId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "title": {
                  "type": "string"
                },
                "parentPageId": {
                  "nullable": true,
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "depth": {
                  "anyOf": [
                    {
                      "type": "number",
                      "enum": [
                        0
                      ]
                    },
                    {
                      "type": "number",
                      "enum": [
                        1
                      ]
                    }
                  ]
                },
                "position": {
                  "type": "integer",
                  "minimum": 0
                },
                "checksum": {
                  "type": "string"
                },
                "shareUrl": {
                  "type": "string"
                },
                "imageUrls": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "pageId",
                "title",
                "parentPageId",
                "depth",
                "position",
                "checksum",
                "shareUrl",
                "imageUrls"
              ],
              "additionalProperties": false
            }
          },
          "viewports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "width": {
                  "type": "integer",
                  "minimum": 0
                },
                "height": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "name",
                "width",
                "height"
              ],
              "additionalProperties": false
            }
          },
          "assertions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "employerUrl",
          "reviewSurface",
          "requiresAuthenticatedEmployerSession",
          "workerCoverage",
          "generatedAt",
          "treeChecksum",
          "pages",
          "viewports",
          "assertions"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringHistoryListResponse": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "pageTitle": {
            "type": "string"
          },
          "archived": {
            "type": "boolean"
          },
          "checkpoints": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "checkpointId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "createdAt": {
                  "type": "string"
                },
                "origin": {
                  "type": "string"
                },
                "actorUserId": {
                  "nullable": true,
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                },
                "actorType": {
                  "type": "string"
                },
                "contentDigest": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0
                },
                "sourceDocumentName": {
                  "type": "string"
                }
              },
              "required": [
                "checkpointId",
                "createdAt",
                "origin",
                "actorUserId",
                "actorType",
                "contentDigest",
                "sizeBytes"
              ],
              "additionalProperties": false
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "nullable": true,
            "type": "string"
          },
          "currentDocumentName": {
            "type": "string"
          }
        },
        "required": [
          "pageId",
          "pageTitle",
          "archived",
          "checkpoints",
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringHistoryReadResponse": {
        "type": "object",
        "properties": {
          "checkpointId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "createdAt": {
            "type": "string"
          },
          "origin": {
            "type": "string"
          },
          "actorUserId": {
            "nullable": true,
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "actorType": {
            "type": "string"
          },
          "contentDigest": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "docJson": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "doc"
                ]
              },
              "content": {
                "maxItems": 100000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "attrs": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "marks": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "attrs": {
                            "type": "object",
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "text": {
                      "type": "string"
                    },
                    "content": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryReadResponse/properties/docJson/properties/content/items"
                      }
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "type",
              "content"
            ],
            "additionalProperties": false
          },
          "plainText": {
            "type": "string"
          },
          "sourceDocumentName": {
            "type": "string"
          }
        },
        "required": [
          "checkpointId",
          "createdAt",
          "origin",
          "actorUserId",
          "actorType",
          "contentDigest",
          "sizeBytes",
          "pageId",
          "docJson",
          "plainText"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringHistoryCompareResponse": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "from": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "checkpoint",
                  "current"
                ]
              },
              "checkpointId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "contentDigest": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              },
              "origin": {
                "type": "string"
              },
              "checksum": {
                "type": "string"
              },
              "documentName": {
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "additionalProperties": false
          },
          "to": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "checkpoint",
                  "current"
                ]
              },
              "checkpointId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "contentDigest": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              },
              "origin": {
                "type": "string"
              },
              "checksum": {
                "type": "string"
              },
              "documentName": {
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "additionalProperties": false
          },
          "diff": {
            "type": "object",
            "properties": {
              "fullReview": {
                "type": "boolean"
              },
              "pages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "pageId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "previousTitle": {
                      "nullable": true,
                      "type": "string"
                    },
                    "kinds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "ADDED",
                          "REMOVED",
                          "RENAMED",
                          "MOVED",
                          "UPDATED"
                        ]
                      }
                    },
                    "blocks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "ADDED",
                              "REMOVED",
                              "MOVED",
                              "MODIFIED",
                              "MEDIA_CHANGED",
                              "TABLE_CHANGED"
                            ]
                          },
                          "blockId": {
                            "type": "string"
                          },
                          "anchorId": {
                            "nullable": true,
                            "type": "string"
                          },
                          "heading": {
                            "nullable": true,
                            "type": "string"
                          },
                          "beforeText": {
                            "nullable": true,
                            "type": "string"
                          },
                          "afterText": {
                            "nullable": true,
                            "type": "string"
                          },
                          "textDelta": {
                            "type": "object",
                            "properties": {
                              "beforePrefix": {
                                "type": "string"
                              },
                              "beforeChanged": {
                                "type": "string"
                              },
                              "beforeSuffix": {
                                "type": "string"
                              },
                              "afterPrefix": {
                                "type": "string"
                              },
                              "afterChanged": {
                                "type": "string"
                              },
                              "afterSuffix": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "beforePrefix",
                              "beforeChanged",
                              "beforeSuffix",
                              "afterPrefix",
                              "afterChanged",
                              "afterSuffix"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "kind",
                          "blockId",
                          "anchorId",
                          "heading",
                          "beforeText",
                          "afterText"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "pageId",
                    "title",
                    "previousTitle",
                    "kinds",
                    "blocks"
                  ],
                  "additionalProperties": false
                }
              },
              "counts": {
                "type": "object",
                "properties": {
                  "pagesAdded": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "pagesRemoved": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "pagesChanged": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "blocksAdded": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "blocksRemoved": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "blocksChanged": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "pagesAdded",
                  "pagesRemoved",
                  "pagesChanged",
                  "blocksAdded",
                  "blocksRemoved",
                  "blocksChanged"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "fullReview",
              "pages",
              "counts"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "pageId",
          "from",
          "to",
          "diff"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringHistoryCheckpointResponse": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "checkpointId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "contentDigest": {
            "type": "string"
          },
          "created": {
            "type": "boolean"
          },
          "liveChecksum": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "pageId",
          "checkpointId",
          "contentDigest",
          "created",
          "liveChecksum",
          "replayed"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringHistoryCheckpointRequest": {
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          }
        },
        "required": [
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringHistoryRestoreResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "location": {
            "type": "object",
            "properties": {
              "canonicalSource": {
                "type": "string",
                "enum": [
                  "FOLDER_INSTRUCTION_SET"
                ]
              },
              "folderId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "employerUrl": {
                "type": "string"
              },
              "instructionSetId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "writeLockedReason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  null
                ]
              }
            },
            "required": [
              "canonicalSource",
              "folderId",
              "employerUrl",
              "instructionSetId",
              "managedAt",
              "writeLockedReason"
            ],
            "additionalProperties": false
          },
          "page": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "instructionSetId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "parentPageId": {
                "nullable": true,
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "title": {
                "type": "string"
              },
              "icon": {
                "nullable": true,
                "type": "string"
              },
              "shareUrl": {
                "type": "string"
              },
              "sortOrder": {
                "type": "integer"
              },
              "contentSchemaVersion": {
                "type": "integer",
                "minimum": 0
              },
              "editable": {
                "type": "boolean"
              },
              "inherited": {
                "type": "boolean"
              },
              "managedAt": {
                "type": "string",
                "enum": [
                  "FOLDER"
                ]
              },
              "children": {
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "instructionSetId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "parentPageId": {
                      "nullable": true,
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "icon": {
                      "nullable": true,
                      "type": "string"
                    },
                    "shareUrl": {
                      "type": "string"
                    },
                    "sortOrder": {
                      "type": "integer"
                    },
                    "contentSchemaVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "editable": {
                      "type": "boolean"
                    },
                    "inherited": {
                      "type": "boolean"
                    },
                    "managedAt": {
                      "type": "string",
                      "enum": [
                        "FOLDER"
                      ]
                    },
                    "children": {
                      "maxItems": 0,
                      "type": "array",
                      "items": {
                        "not": {}
                      }
                    }
                  },
                  "required": [
                    "id",
                    "instructionSetId",
                    "parentPageId",
                    "title",
                    "icon",
                    "shareUrl",
                    "sortOrder",
                    "contentSchemaVersion",
                    "editable",
                    "inherited",
                    "managedAt",
                    "children"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "instructionSetId",
              "parentPageId",
              "title",
              "icon",
              "shareUrl",
              "sortOrder",
              "contentSchemaVersion",
              "editable",
              "inherited",
              "managedAt",
              "children"
            ],
            "additionalProperties": false
          },
          "content": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "opentrain-job-tiptap/1"
                ]
              },
              "doc": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "doc"
                    ]
                  },
                  "content": {
                    "maxItems": 100000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "attrs": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "marks": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "attrs": {
                                "type": "object",
                                "additionalProperties": {}
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "text": {
                          "type": "string"
                        },
                        "content": {
                          "maxItems": 100000,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FolderInstructionAuthoringHistoryRestoreResponse/properties/content/properties/doc/properties/content/items"
                          }
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "additionalProperties": false
              },
              "checksum": {
                "type": "string",
                "pattern": "^[a-fA-F0-9]{64}$"
              }
            },
            "required": [
              "schemaVersion",
              "doc",
              "checksum"
            ],
            "additionalProperties": false
          },
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "restoredCheckpointId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "restoredContentDigest": {
            "type": "string"
          },
          "undoBaselineCheckpointId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "undoBaselineContentDigest": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "location",
          "page",
          "pageId",
          "restoredCheckpointId",
          "restoredContentDigest",
          "undoBaselineCheckpointId",
          "undoBaselineContentDigest",
          "replayed"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringHistoryRestoreRequest": {
        "type": "object",
        "properties": {
          "expectedChecksum": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "confirmRestore": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          }
        },
        "required": [
          "expectedChecksum",
          "confirmRestore",
          "confirmLive",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringSchemaUpgradeResponse": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "contentSchemaVersion": {
            "type": "integer",
            "minimum": 0
          },
          "targetContentSchemaVersion": {
            "type": "integer",
            "minimum": 0
          },
          "recovery": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "enum": [
                  "folder-instruction-schema-recovery/1"
                ]
              },
              "pageId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9._:-]{1,128}$"
              },
              "contentSchemaVersion": {
                "type": "integer",
                "minimum": 0
              },
              "intent": {
                "nullable": true,
                "type": "object",
                "properties": {
                  "intentId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "intentRevision": {
                    "type": "string"
                  },
                  "intentStatus": {
                    "type": "string",
                    "enum": [
                      "PENDING",
                      "COMPLETED",
                      "FAILED",
                      "EXPIRED"
                    ]
                  },
                  "fromVersion": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "toVersion": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "readyAt": {
                    "type": "string"
                  },
                  "expiresAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "intentId",
                  "intentRevision",
                  "intentStatus",
                  "fromVersion",
                  "toVersion",
                  "readyAt",
                  "expiresAt"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "schemaVersion",
              "pageId",
              "contentSchemaVersion",
              "intent"
            ],
            "additionalProperties": false
          },
          "upgrade": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "NOT_REQUESTED",
                  "PENDING",
                  "COMPLETED",
                  "FAILED"
                ]
              },
              "alreadyUpgraded": {
                "type": "boolean"
              },
              "quiesceReadyAt": {
                "type": "string"
              },
              "retryUntil": {
                "type": "string"
              },
              "failureCode": {
                "type": "string"
              }
            },
            "required": [
              "status"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "pageId",
          "contentSchemaVersion",
          "targetContentSchemaVersion",
          "upgrade"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringSchemaUpgradeRequest": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "request",
              "status",
              "complete"
            ]
          }
        },
        "required": [
          "action"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPlanImageResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "url": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "writesApplied": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "url",
          "contentType",
          "sizeBytes",
          "sha256",
          "idempotencyKey",
          "writesApplied"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringPlanImageRequest": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240
          },
          "contentType": {
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "image/gif",
              "image/avif"
            ]
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4194304
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          }
        },
        "required": [
          "fileName",
          "contentType",
          "sizeBytes",
          "sha256",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringUploadImageResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "url": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "replayed": {
            "type": "boolean"
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "url",
          "contentType",
          "sizeBytes",
          "replayed"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringVideoPrepareResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "assetId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING"
            ]
          },
          "protocol": {
            "type": "string",
            "enum": [
              "tus"
            ]
          },
          "chunkBytes": {
            "type": "integer",
            "minimum": 0
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "fileName": {
            "type": "string"
          },
          "uploadMaxDurationSeconds": {
            "type": "integer",
            "minimum": 0
          },
          "uploadExpiresAt": {
            "type": "string"
          },
          "node": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image"
                ]
              },
              "src": {
                "type": "string"
              },
              "alt": {
                "type": "string",
                "enum": [
                  "opentrain-instruction-video:upload"
                ]
              }
            },
            "required": [
              "type",
              "src",
              "alt"
            ],
            "additionalProperties": false
          },
          "replayed": {
            "type": "boolean"
          },
          "uploadUrl": {
            "nullable": true,
            "type": "string"
          },
          "recovery": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "UPLOAD_URL_NOT_REPLAYABLE"
                ]
              },
              "message": {
                "type": "string"
              },
              "statusPath": {
                "type": "string"
              },
              "cancelPath": {
                "type": "string"
              }
            },
            "required": [
              "reason",
              "message",
              "statusPath",
              "cancelPath"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "pageId",
          "assetId",
          "status",
          "protocol",
          "chunkBytes",
          "contentType",
          "sizeBytes",
          "fileName",
          "uploadMaxDurationSeconds",
          "uploadExpiresAt",
          "node",
          "replayed",
          "uploadUrl"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringVideoPrepareRequest": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "contentType": {
            "type": "string",
            "enum": [
              "video/mp4",
              "video/webm",
              "video/ogg",
              "video/quicktime"
            ]
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000000000
          },
          "durationSeconds": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "maximum": 7200
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          }
        },
        "required": [
          "pageId",
          "fileName",
          "contentType",
          "sizeBytes",
          "durationSeconds",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringVideoStatusResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "assetId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "provider": {
            "type": "string",
            "enum": [
              "SUPABASE",
              "CLOUDFLARE_STREAM"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "READY",
              "ERRORED"
            ]
          },
          "storageReady": {
            "type": "boolean"
          },
          "playbackReady": {
            "type": "boolean"
          },
          "browserVerified": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "url": {
            "type": "string"
          },
          "durationSeconds": {
            "nullable": true,
            "type": "number"
          },
          "widthPx": {
            "nullable": true,
            "type": "integer",
            "minimum": 0
          },
          "heightPx": {
            "nullable": true,
            "type": "integer",
            "minimum": 0
          },
          "errorCode": {
            "nullable": true,
            "type": "string"
          },
          "uploadExpiresAt": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "pageId",
          "assetId",
          "provider",
          "status",
          "storageReady",
          "playbackReady",
          "browserVerified",
          "url",
          "durationSeconds",
          "widthPx",
          "heightPx",
          "errorCode",
          "uploadExpiresAt"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringVideoCancelResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "assetId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "canceled",
              "canceling",
              "ready"
            ]
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "assetId",
          "status"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringVideoCancelRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "FolderInstructionAuthoringAssetPrepareResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "assetId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "AUDIO",
              "FILE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING"
            ]
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "fileName": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "upload": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "PUT"
                ]
              },
              "contentType": {
                "type": "string"
              },
              "maxBytes": {
                "type": "integer",
                "minimum": 0
              },
              "finalizeRequired": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            },
            "required": [
              "method",
              "contentType",
              "maxBytes",
              "finalizeRequired"
            ],
            "additionalProperties": false
          },
          "uploadExpiresAt": {
            "nullable": true,
            "type": "string"
          },
          "node": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "instructionAudio"
                    ]
                  },
                  "attrs": {
                    "type": "object",
                    "properties": {
                      "assetId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "assetId",
                      "title"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "attrs"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "instructionAttachment"
                    ]
                  },
                  "attrs": {
                    "type": "object",
                    "properties": {
                      "assetId": {
                        "type": "string"
                      },
                      "fileName": {
                        "type": "string"
                      },
                      "contentType": {
                        "type": "string"
                      },
                      "sizeBytes": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "assetId",
                      "fileName",
                      "contentType",
                      "sizeBytes"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "attrs"
                ],
                "additionalProperties": false
              }
            ]
          },
          "replayed": {
            "type": "boolean"
          },
          "uploadUrl": {
            "nullable": true,
            "type": "string"
          },
          "recovery": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "UPLOAD_URL_NOT_REPLAYABLE"
                ]
              },
              "message": {
                "type": "string"
              },
              "statusPath": {
                "type": "string"
              },
              "cancelPath": {
                "type": "string"
              }
            },
            "required": [
              "reason",
              "message",
              "statusPath",
              "cancelPath"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "pageId",
          "assetId",
          "kind",
          "status",
          "contentType",
          "sizeBytes",
          "fileName",
          "url",
          "upload",
          "uploadExpiresAt",
          "node",
          "replayed",
          "uploadUrl"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringAssetPrepareRequest": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "contentType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 52428800
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          }
        },
        "required": [
          "pageId",
          "fileName",
          "contentType",
          "sizeBytes",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringAssetStatusResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "pageId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "assetId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "AUDIO",
              "FILE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "READY",
              "ERRORED"
            ]
          },
          "storageReady": {
            "type": "boolean"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "fileName": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "errorCode": {
            "nullable": true,
            "type": "string"
          },
          "uploadExpiresAt": {
            "nullable": true,
            "type": "string"
          },
          "node": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "instructionAudio"
                    ]
                  },
                  "attrs": {
                    "type": "object",
                    "properties": {
                      "assetId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "assetId",
                      "title"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "attrs"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "instructionAttachment"
                    ]
                  },
                  "attrs": {
                    "type": "object",
                    "properties": {
                      "assetId": {
                        "type": "string"
                      },
                      "fileName": {
                        "type": "string"
                      },
                      "contentType": {
                        "type": "string"
                      },
                      "sizeBytes": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "assetId",
                      "fileName",
                      "contentType",
                      "sizeBytes"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "attrs"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "pageId",
          "assetId",
          "kind",
          "status",
          "storageReady",
          "contentType",
          "sizeBytes",
          "fileName",
          "url",
          "errorCode",
          "uploadExpiresAt",
          "node"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringAssetFinalizeResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "assetId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "AUDIO",
              "FILE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "READY"
            ]
          },
          "url": {
            "type": "string"
          },
          "node": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "instructionAudio"
                    ]
                  },
                  "attrs": {
                    "type": "object",
                    "properties": {
                      "assetId": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "assetId",
                      "title"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "attrs"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "instructionAttachment"
                    ]
                  },
                  "attrs": {
                    "type": "object",
                    "properties": {
                      "assetId": {
                        "type": "string"
                      },
                      "fileName": {
                        "type": "string"
                      },
                      "contentType": {
                        "type": "string"
                      },
                      "sizeBytes": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "assetId",
                      "fileName",
                      "contentType",
                      "sizeBytes"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "attrs"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "assetId",
          "kind",
          "status",
          "url",
          "node"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringAssetFinalizeRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "FolderInstructionAuthoringAssetCancelResponse": {
        "type": "object",
        "properties": {
          "canonicalSource": {
            "type": "string",
            "enum": [
              "FOLDER_INSTRUCTION_SET"
            ]
          },
          "folderId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "assetId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "canceled",
              "canceling",
              "ready"
            ]
          }
        },
        "required": [
          "canonicalSource",
          "folderId",
          "assetId",
          "status"
        ],
        "additionalProperties": false
      },
      "FolderInstructionAuthoringAssetCancelRequest": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "AgreementSendPlanPreflightRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "jobIds",
          "audience"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "preflight"
            ]
          },
          "jobIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 64
            }
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "selectedContractIds": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Only with audience SELECTED; contract ids of the listed jobs (see GET /agreements/recipients)."
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ],
            "default": "NONE"
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "default": null
          },
          "laterJoinerDueDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 30,
            "default": null,
            "description": "Days a person added later gets to sign."
          },
          "todoTitle": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 180,
            "default": null,
            "description": "The to-do title; null = the document title."
          },
          "todoNote": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000,
            "default": null,
            "description": "The to-do note; null = \"Review and sign <title> in OpenTrain.\""
          }
        }
      },
      "AgreementSendPlanCreateLiveRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "documentId",
          "jobIds",
          "audience",
          "preflightReceipt",
          "confirmLive",
          "yes"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "create"
            ]
          },
          "documentId": {
            "type": "string",
            "maxLength": 64
          },
          "jobIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 64
            }
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "selectedContractIds": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Only with audience SELECTED; contract ids of the listed jobs (see GET /agreements/recipients)."
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ],
            "default": "NONE"
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "default": null
          },
          "laterJoinerDueDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 30,
            "default": null,
            "description": "Days a person added later gets to sign."
          },
          "todoTitle": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 180,
            "default": null,
            "description": "The to-do title; null = the document title."
          },
          "todoNote": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000,
            "default": null,
            "description": "The to-do note; null = \"Review and sign <title> in OpenTrain.\""
          },
          "preflightReceipt": {
            "type": "string",
            "minLength": 16,
            "maxLength": 8192,
            "description": "The receipt the preflight returned (valid for 15 minutes)."
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "yes": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "AgreementSendPlanCreateRequest": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AgreementSendPlanPreflightRequest"
          },
          {
            "$ref": "#/components/schemas/AgreementSendPlanCreateLiveRequest"
          }
        ]
      },
      "AgreementSendPlanPreflightResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "audience",
          "includesFutureHires",
          "blockingMode",
          "dueAt",
          "laterJoinerDueDays",
          "jobs",
          "totalRecipientCount",
          "receipt",
          "warnings"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "preflight"
            ]
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "includesFutureHires": {
            "type": "boolean"
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ]
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "laterJoinerDueDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 30
          },
          "jobs": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "jobId",
                "currentRecipientCount",
                "recipients",
                "recipientsTruncated"
              ],
              "properties": {
                "jobId": {
                  "type": "string"
                },
                "currentRecipientCount": {
                  "type": "integer",
                  "minimum": 0
                },
                "recipients": {
                  "type": "array",
                  "maxItems": 500,
                  "items": {
                    "$ref": "#/components/schemas/AgreementAttachRecipient"
                  }
                },
                "recipientsTruncated": {
                  "type": "boolean"
                }
              }
            }
          },
          "totalRecipientCount": {
            "type": "integer",
            "minimum": 0
          },
          "receipt": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "token",
              "expiresAt"
            ],
            "properties": {
              "token": {
                "type": "string"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "warnings": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgreementSendPlan": {
        "type": "object",
        "additionalProperties": false,
        "description": "A signing to-do set up before its fields are placed. WAITING_FOR_FIELDS until the employer saves on placeFieldsUrl; SENT once; NEEDS_CONFIRM when the people moved since the confirmed preview and nothing was sent; EXPIRED after 7 days without a save; CANCELLED.",
        "required": [
          "sendPlanId",
          "documentId",
          "status",
          "planRevision",
          "placeFieldsUrl",
          "fieldsPlaced",
          "plan",
          "includesFutureHires",
          "jobs",
          "confirmedRecipientCount",
          "expiresAt",
          "sent",
          "needsConfirm",
          "cancelledAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "sendPlanId": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "WAITING_FOR_FIELDS",
              "SENT",
              "NEEDS_CONFIRM",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "planRevision": {
            "type": "integer",
            "minimum": 1
          },
          "placeFieldsUrl": {
            "type": "string",
            "format": "uri",
            "description": "The place page (/employer-dashboard/agreements/<documentId>/place): a plain app URL with no token; the employer signs in normally."
          },
          "fieldsPlaced": {
            "type": "boolean"
          },
          "plan": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "jobIds",
              "audience",
              "selectedContractIds",
              "blockingMode",
              "dueAt",
              "laterJoinerDueDays",
              "todoTitle",
              "todoNote"
            ],
            "properties": {
              "jobIds": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              },
              "audience": {
                "type": "string",
                "enum": [
                  "ACTIVE",
                  "FUTURE",
                  "ACTIVE_AND_FUTURE",
                  "SELECTED"
                ]
              },
              "selectedContractIds": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              },
              "blockingMode": {
                "type": "string",
                "enum": [
                  "NONE",
                  "IMMEDIATE",
                  "AFTER_DUE"
                ]
              },
              "dueAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "laterJoinerDueDays": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1,
                "maximum": 30
              },
              "todoTitle": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 180
              },
              "todoNote": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 5000
              }
            }
          },
          "includesFutureHires": {
            "type": "boolean"
          },
          "jobs": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "jobId",
                "confirmedRecipientCount"
              ],
              "properties": {
                "jobId": {
                  "type": "string"
                },
                "confirmedRecipientCount": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "confirmedRecipientCount": {
            "type": "integer",
            "minimum": 0
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sent": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "sentAt",
              "versionId",
              "recipientCount",
              "todos",
              "requestCount"
            ],
            "properties": {
              "sentAt": {
                "type": "string",
                "format": "date-time"
              },
              "versionId": {
                "type": "string"
              },
              "recipientCount": {
                "type": "integer",
                "minimum": 0
              },
              "todos": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "itemId",
                    "todoVersionId"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "itemId": {
                      "type": "string"
                    },
                    "todoVersionId": {
                      "type": "string"
                    }
                  }
                }
              },
              "requestCount": {
                "type": "integer",
                "minimum": 0,
                "description": "Signing requests of the sent version, read at request time."
              }
            }
          },
          "needsConfirm": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "detectedAt",
              "versionId",
              "jobs"
            ],
            "properties": {
              "detectedAt": {
                "type": "string",
                "format": "date-time"
              },
              "versionId": {
                "type": "string"
              },
              "jobs": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "confirmedRecipientCount",
                    "currentRecipientCount",
                    "addedContractIds",
                    "removedContractIds",
                    "idsTruncated"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "confirmedRecipientCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "currentRecipientCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "addedContractIds": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "removedContractIds": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "idsTruncated": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "cancelledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgreementSendPlanCreateResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "sendPlan",
          "replayed"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "create"
            ]
          },
          "sendPlan": {
            "$ref": "#/components/schemas/AgreementSendPlan"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementSendPlanCreateResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AgreementSendPlanPreflightResponse"
          },
          {
            "$ref": "#/components/schemas/AgreementSendPlanCreateResult"
          }
        ]
      },
      "AgreementSendPlanEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sendPlan"
        ],
        "properties": {
          "sendPlan": {
            "$ref": "#/components/schemas/AgreementSendPlan"
          }
        }
      },
      "AgreementSendPlanUpdateRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sendPlanId",
          "expectedPlanRevision",
          "jobIds",
          "audience",
          "preflightReceipt",
          "confirmLive",
          "yes"
        ],
        "properties": {
          "sendPlanId": {
            "type": "string",
            "maxLength": 64,
            "description": "Must equal the path id."
          },
          "expectedPlanRevision": {
            "type": "integer",
            "minimum": 1
          },
          "jobIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 64
            }
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "selectedContractIds": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Only with audience SELECTED; contract ids of the listed jobs (see GET /agreements/recipients)."
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ],
            "default": "NONE"
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "default": null
          },
          "laterJoinerDueDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 30,
            "default": null,
            "description": "Days a person added later gets to sign."
          },
          "todoTitle": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 180,
            "default": null,
            "description": "The to-do title; null = the document title."
          },
          "todoNote": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000,
            "default": null,
            "description": "The to-do note; null = \"Review and sign <title> in OpenTrain.\""
          },
          "preflightReceipt": {
            "type": "string",
            "minLength": 16,
            "maxLength": 8192,
            "description": "The receipt the preflight returned (valid for 15 minutes)."
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "yes": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "AgreementSendPlanWriteResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sendPlan",
          "replayed"
        ],
        "properties": {
          "sendPlan": {
            "$ref": "#/components/schemas/AgreementSendPlan"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementSendPlanCancelRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sendPlanId",
          "confirmLive"
        ],
        "properties": {
          "sendPlanId": {
            "type": "string",
            "maxLength": 64,
            "description": "Must equal the path id."
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "AgreementRecipientListResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jobId",
          "recipients",
          "totalCount",
          "truncated"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "recipients": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/AgreementAttachRecipient"
            }
          },
          "totalCount": {
            "type": "integer",
            "minimum": 0
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "AgreementSendPlanOrNull": {
        "type": [
          "object",
          "null"
        ],
        "additionalProperties": false,
        "description": "The document's send plan, or null when it has none. Only when X-OpenTrain-Features names agreements-document-send-plan-v1.",
        "required": [
          "sendPlanId",
          "documentId",
          "status",
          "planRevision",
          "placeFieldsUrl",
          "fieldsPlaced",
          "plan",
          "includesFutureHires",
          "jobs",
          "confirmedRecipientCount",
          "expiresAt",
          "sent",
          "needsConfirm",
          "cancelledAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "sendPlanId": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "WAITING_FOR_FIELDS",
              "SENT",
              "NEEDS_CONFIRM",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "planRevision": {
            "type": "integer",
            "minimum": 1
          },
          "placeFieldsUrl": {
            "type": "string",
            "format": "uri",
            "description": "The place page (/employer-dashboard/agreements/<documentId>/place): a plain app URL with no token; the employer signs in normally."
          },
          "fieldsPlaced": {
            "type": "boolean"
          },
          "plan": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "jobIds",
              "audience",
              "selectedContractIds",
              "blockingMode",
              "dueAt",
              "laterJoinerDueDays",
              "todoTitle",
              "todoNote"
            ],
            "properties": {
              "jobIds": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              },
              "audience": {
                "type": "string",
                "enum": [
                  "ACTIVE",
                  "FUTURE",
                  "ACTIVE_AND_FUTURE",
                  "SELECTED"
                ]
              },
              "selectedContractIds": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              },
              "blockingMode": {
                "type": "string",
                "enum": [
                  "NONE",
                  "IMMEDIATE",
                  "AFTER_DUE"
                ]
              },
              "dueAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "laterJoinerDueDays": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1,
                "maximum": 30
              },
              "todoTitle": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 180
              },
              "todoNote": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 5000
              }
            }
          },
          "includesFutureHires": {
            "type": "boolean"
          },
          "jobs": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "jobId",
                "confirmedRecipientCount"
              ],
              "properties": {
                "jobId": {
                  "type": "string"
                },
                "confirmedRecipientCount": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "confirmedRecipientCount": {
            "type": "integer",
            "minimum": 0
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sent": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "sentAt",
              "versionId",
              "recipientCount",
              "todos",
              "requestCount"
            ],
            "properties": {
              "sentAt": {
                "type": "string",
                "format": "date-time"
              },
              "versionId": {
                "type": "string"
              },
              "recipientCount": {
                "type": "integer",
                "minimum": 0
              },
              "todos": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "itemId",
                    "todoVersionId"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "itemId": {
                      "type": "string"
                    },
                    "todoVersionId": {
                      "type": "string"
                    }
                  }
                }
              },
              "requestCount": {
                "type": "integer",
                "minimum": 0,
                "description": "Signing requests of the sent version, read at request time."
              }
            }
          },
          "needsConfirm": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "detectedAt",
              "versionId",
              "jobs"
            ],
            "properties": {
              "detectedAt": {
                "type": "string",
                "format": "date-time"
              },
              "versionId": {
                "type": "string"
              },
              "jobs": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "jobId",
                    "confirmedRecipientCount",
                    "currentRecipientCount",
                    "addedContractIds",
                    "removedContractIds",
                    "idsTruncated"
                  ],
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "confirmedRecipientCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "currentRecipientCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "addedContractIds": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "removedContractIds": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "idsTruncated": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "cancelledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgreementRect": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "x",
          "y",
          "width",
          "height"
        ],
        "description": "PDF points from the top-left of the visible page (CropBox and /Rotate normalised).",
        "properties": {
          "x": {
            "type": "number",
            "minimum": 0
          },
          "y": {
            "type": "number",
            "minimum": 0
          },
          "width": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "height": {
            "type": "number",
            "exclusiveMinimum": 0
          }
        }
      },
      "AgreementWarning": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "ANCHOR_NOT_FOUND",
              "ANCHOR_AMBIGUOUS",
              "FIELD_OVERLAP",
              "FIELD_OUT_OF_BOUNDS",
              "FIELD_OVER_TEXT",
              "ROLE_HAS_NO_SIGNATURE",
              "MERGE_VALUE_MISSING",
              "GLYPH_UNSUPPORTED"
            ]
          },
          "message": {
            "type": "string"
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "fieldId": {
            "type": "string"
          }
        }
      },
      "AgreementFieldRecord": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "fieldId",
          "type",
          "required",
          "page",
          "rect",
          "units",
          "origin",
          "source"
        ],
        "description": "The canonical, stored field (agent-contract.md §4).",
        "properties": {
          "fieldId": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "signature",
              "initials",
              "date",
              "name",
              "email",
              "text",
              "checkbox",
              "merge"
            ]
          },
          "role": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "key": {
            "type": "string"
          },
          "mergeKey": {
            "type": "string",
            "enum": [
              "freelancer.legal_name",
              "freelancer.email",
              "freelancer.work_location",
              "contract.start_date",
              "contract.hourly_rate_usd",
              "job.title",
              "employer.legal_name",
              "today"
            ]
          },
          "label": {
            "type": "string"
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "rect": {
            "$ref": "#/components/schemas/AgreementRect"
          },
          "units": {
            "type": "string",
            "enum": [
              "pt"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "top-left-of-cropbox"
            ]
          },
          "source": {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "token",
                  "text_anchor",
                  "structural",
                  "coordinate",
                  "editor"
                ]
              }
            }
          }
        }
      },
      "AgreementFieldInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "fieldId",
          "type",
          "placement"
        ],
        "description": "Signer fields need `role`; `merge` fields need `mergeKey`. `size` (points) applies to token, anchor and structural placements.",
        "properties": {
          "fieldId": {
            "type": "string",
            "maxLength": 64
          },
          "type": {
            "type": "string",
            "enum": [
              "signature",
              "initials",
              "date",
              "name",
              "email",
              "text",
              "checkbox",
              "merge"
            ]
          },
          "role": {
            "type": "string"
          },
          "required": {
            "type": "boolean",
            "default": true
          },
          "key": {
            "type": "string"
          },
          "mergeKey": {
            "type": "string",
            "enum": [
              "freelancer.legal_name",
              "freelancer.email",
              "freelancer.work_location",
              "contract.start_date",
              "contract.hourly_rate_usd",
              "job.title",
              "employer.legal_name",
              "today"
            ]
          },
          "label": {
            "type": "string",
            "maxLength": 120
          },
          "size": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "width",
              "height"
            ],
            "properties": {
              "width": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "height": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            }
          },
          "placement": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "token"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "token"
                    ]
                  },
                  "token": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 200
                  },
                  "occurrence": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "text"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "text_anchor"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "place": {
                    "type": "string",
                    "enum": [
                      "right",
                      "left",
                      "above",
                      "below",
                      "over"
                    ],
                    "default": "right"
                  },
                  "occurrence": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "offsetPt": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "x",
                      "y"
                    ],
                    "properties": {
                      "x": {
                        "type": "number"
                      },
                      "y": {
                        "type": "number"
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "after"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "structural"
                    ]
                  },
                  "after": {
                    "type": "string",
                    "enum": [
                      "end_of_document"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "units",
                  "page",
                  "rect"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "coordinate"
                    ]
                  },
                  "units": {
                    "type": "string",
                    "enum": [
                      "pt",
                      "pct"
                    ]
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "rect": {
                    "$ref": "#/components/schemas/AgreementRect"
                  }
                }
              }
            ]
          }
        }
      },
      "AgreementDocument": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documentId",
          "key",
          "title",
          "description",
          "sourceKind",
          "draftRevision",
          "source",
          "fields",
          "currentVersion",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceKind": {
            "type": "string",
            "enum": [
              "EDITOR",
              "PDF_UPLOAD",
              "MARKDOWN",
              "HTML",
              "DOCX_EDITABLE",
              "DOCX_LAYOUT"
            ]
          },
          "draftRevision": {
            "type": "integer",
            "minimum": 0
          },
          "source": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "status",
              "fileName",
              "sha256"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "NONE",
                  "PENDING",
                  "READY"
                ]
              },
              "fileName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sha256": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          },
          "fields": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "count",
              "fieldsHash"
            ],
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 0
              },
              "fieldsHash": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          },
          "currentVersion": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "versionId",
              "versionNumber",
              "publishedAt"
            ],
            "properties": {
              "versionId": {
                "type": "string"
              },
              "versionNumber": {
                "type": "integer",
                "minimum": 1
              },
              "publishedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgreementDocumentList": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documents",
          "nextCursor"
        ],
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementDocument"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AgreementDocumentEnvelope": {
        "type": "object",
        "required": [
          "document"
        ],
        "properties": {
          "document": {
            "$ref": "#/components/schemas/AgreementDocument"
          },
          "fieldsPlaced": {
            "type": "boolean",
            "description": "True once the draft has at least one field. Only when X-OpenTrain-Features names agreements-document-send-plan-v1."
          },
          "sendPlan": {
            "$ref": "#/components/schemas/AgreementSendPlanOrNull"
          }
        }
      },
      "AgreementDocumentCreateResponse": {
        "type": "object",
        "required": [
          "document",
          "replayed"
        ],
        "properties": {
          "document": {
            "$ref": "#/components/schemas/AgreementDocument"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementDocumentCreateRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title",
          "sourceKind"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          },
          "sourceKind": {
            "type": "string",
            "enum": [
              "EDITOR",
              "PDF_UPLOAD",
              "MARKDOWN",
              "HTML",
              "DOCX_EDITABLE",
              "DOCX_LAYOUT"
            ],
            "description": "PDF_UPLOAD, or DOCX_LAYOUT: a Word file the pinned converter turns into the draft PDF at upload finalize, layout kept (503 AGREEMENTS_NOT_CONFIGURED where the converter is not set up). The other kinds are 422 DOCUMENT_TYPE_UNSUPPORTED on this route."
          }
        }
      },
      "AgreementUploadPrepareRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documentId",
          "expectedRevision",
          "fileName",
          "contentType",
          "sizeBytes"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0
          },
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "contentType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
            ],
            "description": "application/pdf for PDF_UPLOAD; the Word type (at most 20 MB) for DOCX_LAYOUT."
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 52428800
          }
        }
      },
      "AgreementUploadPrepareResponse": {
        "type": "object",
        "required": [
          "documentId",
          "uploadId",
          "upload",
          "replayed"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "uploadId": {
            "type": "string"
          },
          "replayed": {
            "type": "boolean"
          },
          "upload": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "method",
              "url",
              "headers",
              "expiresAt"
            ],
            "description": "Signed PUT straight to private storage (bytes never pass through the API); send the headers as given.",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "PUT"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "AgreementUploadFinalizeRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documentId",
          "uploadId"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "uploadId": {
            "type": "string"
          },
          "expectedSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "AgreementUploadFinalizeResponse": {
        "type": "object",
        "required": [
          "document",
          "pageCount",
          "byteSize",
          "replayed"
        ],
        "properties": {
          "document": {
            "$ref": "#/components/schemas/AgreementDocument"
          },
          "pageCount": {
            "type": "integer",
            "minimum": 1
          },
          "byteSize": {
            "type": "integer",
            "minimum": 1
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementFieldsSetRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expectedRevision",
          "fields"
        ],
        "properties": {
          "documentId": {
            "type": "string",
            "description": "Optional; must equal the path id."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0
          },
          "fields": {
            "type": "array",
            "minItems": 1,
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/AgreementFieldInput"
            }
          },
          "waivedWarnings": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "enum": [
                "ANCHOR_NOT_FOUND",
                "ANCHOR_AMBIGUOUS",
                "FIELD_OVERLAP",
                "FIELD_OUT_OF_BOUNDS",
                "FIELD_OVER_TEXT",
                "ROLE_HAS_NO_SIGNATURE",
                "MERGE_VALUE_MISSING",
                "GLYPH_UNSUPPORTED"
              ]
            }
          }
        }
      },
      "AgreementFieldsSetResponse": {
        "type": "object",
        "required": [
          "documentId",
          "draftRevision",
          "fields",
          "warnings",
          "fieldsHash",
          "replayed"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "draftRevision": {
            "type": "integer",
            "minimum": 0
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementFieldRecord"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementWarning"
            }
          },
          "fieldsHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementResourceHandle": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "expiresAt"
        ],
        "description": "Short-lived private handle; fetch the bytes with GET /agreements/resources/{resourceId}. Never a storage key or signed URL.",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgreementPreviewResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documentId",
          "draftRevision",
          "pages",
          "warnings"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "draftRevision": {
            "type": "integer",
            "minimum": 0
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "page",
                "resource",
                "fields",
                "warnings"
              ],
              "properties": {
                "page": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10000
                },
                "resource": {
                  "$ref": "#/components/schemas/AgreementResourceHandle"
                },
                "fields": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "fieldId",
                      "rect",
                      "label"
                    ],
                    "properties": {
                      "fieldId": {
                        "type": "string"
                      },
                      "rect": {
                        "$ref": "#/components/schemas/AgreementRect"
                      },
                      "label": {
                        "type": "string"
                      }
                    }
                  }
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgreementWarning"
                  }
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementWarning"
            }
          }
        }
      },
      "AgreementPublishRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expectedRevision",
          "confirmLive"
        ],
        "properties": {
          "documentId": {
            "type": "string",
            "description": "Optional; must equal the path id."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Publishing freezes the document people will sign."
          },
          "waivedWarnings": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "enum": [
                "ANCHOR_NOT_FOUND",
                "ANCHOR_AMBIGUOUS",
                "FIELD_OVERLAP",
                "FIELD_OUT_OF_BOUNDS",
                "FIELD_OVER_TEXT",
                "ROLE_HAS_NO_SIGNATURE",
                "MERGE_VALUE_MISSING",
                "GLYPH_UNSUPPORTED"
              ]
            }
          }
        }
      },
      "AgreementPublishResponse": {
        "type": "object",
        "required": [
          "documentId",
          "versionId",
          "versionNumber",
          "draftRevision",
          "basePdfSha256",
          "fieldsHash",
          "definitionHash",
          "pageCount",
          "publishedAt",
          "replayed"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "versionId": {
            "type": "string"
          },
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "draftRevision": {
            "type": "integer",
            "minimum": 0
          },
          "basePdfSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "fieldsHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "definitionHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "pageCount": {
            "type": "integer",
            "minimum": 1
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementAttachPreflightRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "versionId",
          "jobIds",
          "audience"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "preflight"
            ]
          },
          "versionId": {
            "type": "string",
            "maxLength": 64,
            "description": "Must equal the path id."
          },
          "jobIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 64
            }
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "selectedContractIds": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Only with audience SELECTED; each id must be a contract of one listed job."
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ],
            "default": "NONE"
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "default": null
          },
          "laterJoinerDueDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 30,
            "default": null,
            "description": "Days a person added to the job later gets to sign. With dueAt set, dueAt must be at least this many days away."
          }
        }
      },
      "AgreementAttachLiveRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "versionId",
          "jobIds",
          "audience",
          "preflightReceipt",
          "confirmLive",
          "yes"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "attach"
            ]
          },
          "versionId": {
            "type": "string",
            "maxLength": 64,
            "description": "Must equal the path id."
          },
          "jobIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 64
            }
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "selectedContractIds": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Only with audience SELECTED; each id must be a contract of one listed job."
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ],
            "default": "NONE"
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "default": null
          },
          "laterJoinerDueDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 30,
            "default": null,
            "description": "Days a person added to the job later gets to sign. With dueAt set, dueAt must be at least this many days away."
          },
          "preflightReceipt": {
            "type": "string",
            "minLength": 16,
            "maxLength": 8192,
            "description": "The receipt the preflight returned (valid for 15 minutes)."
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "yes": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "AgreementAttachRequest": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AgreementAttachPreflightRequest"
          },
          {
            "$ref": "#/components/schemas/AgreementAttachLiveRequest"
          }
        ]
      },
      "AgreementAttachRecipient": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contractId",
          "displayName"
        ],
        "properties": {
          "contractId": {
            "type": "string"
          },
          "displayName": {
            "type": "string",
            "description": "Masked \"First L.\" name."
          }
        }
      },
      "AgreementAttachPreflightResponse": {
        "type": "object",
        "required": [
          "action",
          "versionId",
          "documentId",
          "versionNumber",
          "definitionHash",
          "basePdfSha256",
          "audience",
          "includesFutureHires",
          "blockingMode",
          "dueAt",
          "jobs",
          "totalRecipientCount",
          "receipt",
          "warnings"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "preflight"
            ]
          },
          "versionId": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "definitionHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "basePdfSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "audience": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "FUTURE",
              "ACTIVE_AND_FUTURE",
              "SELECTED"
            ]
          },
          "includesFutureHires": {
            "type": "boolean"
          },
          "blockingMode": {
            "type": "string",
            "enum": [
              "NONE",
              "IMMEDIATE",
              "AFTER_DUE"
            ]
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "jobs": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "jobId",
                "currentRecipientCount",
                "recipients",
                "recipientsTruncated"
              ],
              "properties": {
                "jobId": {
                  "type": "string"
                },
                "currentRecipientCount": {
                  "type": "integer",
                  "minimum": 0
                },
                "recipients": {
                  "type": "array",
                  "maxItems": 500,
                  "items": {
                    "$ref": "#/components/schemas/AgreementAttachRecipient"
                  }
                },
                "recipientsTruncated": {
                  "type": "boolean"
                }
              }
            }
          },
          "totalRecipientCount": {
            "type": "integer",
            "minimum": 0
          },
          "receipt": {
            "type": "object",
            "required": [
              "token",
              "expiresAt"
            ],
            "properties": {
              "token": {
                "type": "string"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "warnings": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgreementAttachJobResult": {
        "type": "object",
        "required": [
          "jobId",
          "itemId",
          "todoVersionId",
          "createdAssignments",
          "skippedExistingAssignments",
          "queued",
          "failed",
          "requests"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "itemId": {
            "type": "string"
          },
          "todoVersionId": {
            "type": "string"
          },
          "createdAssignments": {
            "type": "integer",
            "minimum": 0
          },
          "skippedExistingAssignments": {
            "type": "integer",
            "minimum": 0
          },
          "queued": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          },
          "requests": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "object",
              "required": [
                "requestId",
                "assignmentId",
                "contractId",
                "status"
              ],
              "properties": {
                "requestId": {
                  "type": "string",
                  "description": "native:<attemptId>"
                },
                "assignmentId": {
                  "type": "string"
                },
                "contractId": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AgreementAttachResult": {
        "type": "object",
        "required": [
          "action",
          "versionId",
          "includesFutureHires",
          "jobs",
          "queuedCount",
          "failures",
          "replayed"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "attach"
            ]
          },
          "versionId": {
            "type": "string"
          },
          "includesFutureHires": {
            "type": "boolean"
          },
          "jobs": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/AgreementAttachJobResult"
            }
          },
          "queuedCount": {
            "type": "integer",
            "minimum": 0
          },
          "failures": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            }
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementAttachResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AgreementAttachPreflightResponse"
          },
          {
            "$ref": "#/components/schemas/AgreementAttachResult"
          }
        ]
      },
      "AgreementRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "provider",
          "documentId",
          "versionId",
          "versionNumber",
          "jobId",
          "contractId",
          "assignmentId",
          "status",
          "signer",
          "queuedAt",
          "sentAt",
          "lastRemindedAt",
          "signedAt",
          "completedAt",
          "executedDocument",
          "recipients",
          "countersignPath",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "pattern": "^(native|dropbox_sign):[A-Za-z0-9_-]{1,64}$",
            "description": "native:<id> (the value attach returned for an OpenTrain-executed request) or dropbox_sign:<id> (a legacy Dropbox Sign envelope); the prefix is the provider."
          },
          "provider": {
            "type": "string",
            "enum": [
              "OPENTRAIN",
              "DROPBOX_SIGN"
            ],
            "description": "OPENTRAIN: the native flow (evidence chain, certificate, RFC 3161 timestamp). DROPBOX_SIGN: the legacy provider integration, whose only sealed artifact is the executed PDF (its audit trail is inside that PDF)."
          },
          "documentId": {
            "type": "string",
            "maxLength": 64
          },
          "versionId": {
            "type": "string",
            "maxLength": 64
          },
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "contractId": {
            "type": "string",
            "maxLength": 64
          },
          "assignmentId": {
            "type": "string",
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "QUEUED",
              "SENT",
              "VIEWED",
              "CONSENTED",
              "SIGNED",
              "COMPLETED",
              "DECLINED",
              "VOIDED",
              "FAILED",
              "EXPIRED",
              "RETRYING",
              "SENDING",
              "PENDING",
              "SIGNED_PENDING_FILES",
              "CANCELLED",
              "ERROR"
            ],
            "description": "Reported verbatim per provider: the native lifecycle for OPENTRAIN, the Dropbox Sign envelope states for DROPBOX_SIGN."
          },
          "signer": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "displayName"
            ],
            "description": "Masked \"First L.\" name only; the signer email is never returned.",
            "properties": {
              "displayName": {
                "type": "string",
                "maxLength": 120
              }
            }
          },
          "queuedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastRemindedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "signedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "executedDocument": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "available",
              "sha256",
              "byteSize"
            ],
            "description": "The exact executed PDF when one is stored (its SHA-256 and size), so a caller knows whether download?artifact=signed will answer and can verify what it received. Never regenerated from the current template.",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "sha256": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              },
              "byteSize": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            }
          },
          "recipients": {
            "type": "array",
            "maxItems": 10,
            "description": "Empty unless the request needs a counter-signature; then every signer in signing order (the freelancer, then the employer counter-signer), each with a masked name and never an email.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "role",
                "signingOrder",
                "status",
                "displayName",
                "signedAt"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                },
                "signingOrder": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "CONSENTED",
                    "SIGNED",
                    "DECLINED"
                  ]
                },
                "displayName": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 120
                },
                "signedAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              }
            }
          },
          "countersignPath": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "The app path where an organization owner or a member authorized for e-signature counter-signs, once the freelancer has signed; null otherwise. Agents never sign: hand the path to a person."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgreementRequestList": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requests",
          "nextCursor"
        ],
        "properties": {
          "requests": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/AgreementRequest"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AgreementRequestDetail": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "provider",
          "documentId",
          "versionId",
          "versionNumber",
          "jobId",
          "contractId",
          "assignmentId",
          "status",
          "signer",
          "queuedAt",
          "sentAt",
          "lastRemindedAt",
          "signedAt",
          "completedAt",
          "executedDocument",
          "recipients",
          "countersignPath",
          "createdAt",
          "updatedAt",
          "chain"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "pattern": "^(native|dropbox_sign):[A-Za-z0-9_-]{1,64}$",
            "description": "native:<id> (the value attach returned for an OpenTrain-executed request) or dropbox_sign:<id> (a legacy Dropbox Sign envelope); the prefix is the provider."
          },
          "provider": {
            "type": "string",
            "enum": [
              "OPENTRAIN",
              "DROPBOX_SIGN"
            ],
            "description": "OPENTRAIN: the native flow (evidence chain, certificate, RFC 3161 timestamp). DROPBOX_SIGN: the legacy provider integration, whose only sealed artifact is the executed PDF (its audit trail is inside that PDF)."
          },
          "documentId": {
            "type": "string",
            "maxLength": 64
          },
          "versionId": {
            "type": "string",
            "maxLength": 64
          },
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "contractId": {
            "type": "string",
            "maxLength": 64
          },
          "assignmentId": {
            "type": "string",
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "QUEUED",
              "SENT",
              "VIEWED",
              "CONSENTED",
              "SIGNED",
              "COMPLETED",
              "DECLINED",
              "VOIDED",
              "FAILED",
              "EXPIRED",
              "RETRYING",
              "SENDING",
              "PENDING",
              "SIGNED_PENDING_FILES",
              "CANCELLED",
              "ERROR"
            ],
            "description": "Reported verbatim per provider: the native lifecycle for OPENTRAIN, the Dropbox Sign envelope states for DROPBOX_SIGN."
          },
          "signer": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "displayName"
            ],
            "description": "Masked \"First L.\" name only; the signer email is never returned.",
            "properties": {
              "displayName": {
                "type": "string",
                "maxLength": 120
              }
            }
          },
          "queuedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastRemindedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "signedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "executedDocument": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "available",
              "sha256",
              "byteSize"
            ],
            "description": "The exact executed PDF when one is stored (its SHA-256 and size), so a caller knows whether download?artifact=signed will answer and can verify what it received. Never regenerated from the current template.",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "sha256": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              },
              "byteSize": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            }
          },
          "recipients": {
            "type": "array",
            "maxItems": 10,
            "description": "Empty unless the request needs a counter-signature; then every signer in signing order (the freelancer, then the employer counter-signer), each with a masked name and never an email.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "role",
                "signingOrder",
                "status",
                "displayName",
                "signedAt"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                },
                "signingOrder": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "CONSENTED",
                    "SIGNED",
                    "DECLINED"
                  ]
                },
                "displayName": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 120
                },
                "signedAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              }
            }
          },
          "countersignPath": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "The app path where an organization owner or a member authorized for e-signature counter-signs, once the freelancer has signed; null otherwise. Agents never sign: hand the path to a person."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "chain": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "length",
              "headHash"
            ],
            "description": "The evidence hash chain: its length and head hash (never the events). Null for a Dropbox Sign request, which the provider executed and OpenTrain holds no chain for.",
            "properties": {
              "length": {
                "type": "integer",
                "minimum": 0
              },
              "headHash": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          }
        }
      },
      "AgreementRequestEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request"
        ],
        "properties": {
          "request": {
            "$ref": "#/components/schemas/AgreementRequestDetail"
          }
        }
      },
      "AgreementRequestRemindResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "status",
          "remindedAt",
          "nextReminderAllowedAt",
          "replayed"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "pattern": "^native:[A-Za-z0-9_-]{1,64}$",
            "description": "The native:<id> value attach returned for the request (Dropbox Sign requests have no OpenTrain evidence chain or reminders)."
          },
          "status": {
            "type": "string",
            "enum": [
              "QUEUED",
              "SENT",
              "VIEWED",
              "CONSENTED",
              "SIGNED",
              "COMPLETED",
              "DECLINED",
              "VOIDED",
              "FAILED",
              "EXPIRED"
            ]
          },
          "remindedAt": {
            "type": "string",
            "format": "date-time"
          },
          "nextReminderAllowedAt": {
            "type": "string",
            "format": "date-time"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementRequestVoidRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason",
          "confirmLive"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Optional; must equal the path id."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Why the request is voided; recorded on the evidence chain and the closed To-do."
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Voiding withdraws a request a person may be about to sign."
          }
        }
      },
      "AgreementRequestVoidResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "status",
          "previousStatus",
          "voidedAt",
          "todoClosed",
          "replayed"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "pattern": "^native:[A-Za-z0-9_-]{1,64}$",
            "description": "The native:<id> value attach returned for the request (Dropbox Sign requests have no OpenTrain evidence chain or reminders)."
          },
          "status": {
            "type": "string",
            "enum": [
              "VOIDED"
            ]
          },
          "previousStatus": {
            "type": "string",
            "enum": [
              "QUEUED",
              "SENT",
              "VIEWED",
              "CONSENTED",
              "SIGNED",
              "COMPLETED",
              "DECLINED",
              "VOIDED",
              "FAILED",
              "EXPIRED"
            ]
          },
          "voidedAt": {
            "type": "string",
            "format": "date-time"
          },
          "todoClosed": {
            "type": "boolean",
            "description": "Whether the person's agreement To-do was closed with the request (false when it was already resolved)."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementWebhook": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "url",
          "eventTypes",
          "status",
          "createdAt",
          "disabledAt",
          "disabledReason",
          "secretRotatedAt",
          "previousSignatureUntil"
        ],
        "description": "An agreement webhook subscription. Never a secret, a hash or a prefix of one: the secret is only returned by create and rotate.",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "url": {
            "type": "string"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "disabledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "disabledReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "secretRotatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The last rotation; null while the secret is the one returned at creation."
          },
          "previousSignatureUntil": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "While set, each delivery also carries a v1 signature made with the replaced secret."
          }
        }
      },
      "AgreementWebhookListResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "webhooks"
        ],
        "properties": {
          "webhooks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementWebhook"
            }
          }
        }
      },
      "AgreementWebhookRotateRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "confirmLive"
        ],
        "properties": {
          "webhookId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "description": "Optional; must equal the path id."
          },
          "confirmLive": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Rotating changes the value your listener must verify with; the old one stops 24 hours later."
          }
        }
      },
      "AgreementWebhookRotateResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "webhook",
          "secret",
          "replayed"
        ],
        "properties": {
          "webhook": {
            "$ref": "#/components/schemas/AgreementWebhook"
          },
          "secret": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^whsec_[A-Za-z0-9_-]+$",
            "description": "The new signing secret, in the first answer only. A same-key replay answers null; rotate again with a new Idempotency-Key if it was lost."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "AgreementDownloadResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "artifact",
          "resource",
          "sha256",
          "byteSize",
          "mimeType"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "pattern": "^(native|dropbox_sign):[A-Za-z0-9_-]{1,64}$",
            "description": "native:<id> (the value attach returned for an OpenTrain-executed request) or dropbox_sign:<id> (a legacy Dropbox Sign envelope); the prefix is the provider."
          },
          "artifact": {
            "type": "string",
            "enum": [
              "signed",
              "certificate",
              "timestamp",
              "source"
            ]
          },
          "resource": {
            "$ref": "#/components/schemas/AgreementResourceHandle"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "byteSize": {
            "type": "integer",
            "minimum": 1
          },
          "mimeType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "application/timestamp-reply"
            ]
          }
        }
      },
      "AgreementRequestAudit": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "status",
          "document",
          "signedAt",
          "completedAt",
          "chain",
          "events",
          "artifacts",
          "timestamp",
          "consentPolicy"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "pattern": "^native:[A-Za-z0-9_-]{1,64}$",
            "description": "The native:<id> value attach returned for the request (Dropbox Sign requests have no OpenTrain evidence chain or reminders)."
          },
          "status": {
            "type": "string",
            "enum": [
              "QUEUED",
              "SENT",
              "VIEWED",
              "CONSENTED",
              "SIGNED",
              "COMPLETED",
              "DECLINED",
              "VOIDED",
              "FAILED",
              "EXPIRED"
            ]
          },
          "document": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "documentId",
              "versionId",
              "basePdfSha256"
            ],
            "properties": {
              "documentId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "versionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "basePdfSha256": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          },
          "signedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "chain": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "length",
              "headHash",
              "verified"
            ],
            "properties": {
              "length": {
                "type": "integer",
                "minimum": 0
              },
              "headHash": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9a-f]{64}$"
              },
              "verified": {
                "type": "boolean"
              }
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "sequence",
                "type",
                "at",
                "hash",
                "prevHash"
              ],
              "properties": {
                "sequence": {
                  "type": "integer",
                  "minimum": 1
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "REQUEST_QUEUED",
                    "REQUEST_SENT",
                    "REMINDER_SENT",
                    "REQUEST_VOIDED",
                    "VIEWED",
                    "CONSENTED",
                    "FIELDS_CAPTURED",
                    "SIGNED",
                    "DECLINED",
                    "COMPLETED",
                    "REQUEST_EXPIRED"
                  ]
                },
                "at": {
                  "type": "string",
                  "format": "date-time"
                },
                "hash": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "prevHash": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "pattern": "^[0-9a-f]{64}$"
                }
              }
            }
          },
          "artifacts": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "kind",
                "sha256",
                "byteSize",
                "mimeType",
                "verified"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "EXECUTED_PDF",
                    "AUDIT_CERTIFICATE",
                    "TIMESTAMP_TOKEN"
                  ]
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "byteSize": {
                  "type": "integer",
                  "minimum": 1
                },
                "mimeType": {
                  "type": "string",
                  "enum": [
                    "application/pdf",
                    "application/timestamp-reply"
                  ]
                },
                "verified": {
                  "type": "boolean"
                }
              }
            }
          },
          "timestamp": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "authority",
              "genTime",
              "serial",
              "policy",
              "verified"
            ],
            "properties": {
              "authority": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 64
              },
              "genTime": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "serial": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 128
              },
              "policy": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 128
              },
              "verified": {
                "type": "boolean"
              }
            }
          },
          "consentPolicy": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "versionId",
              "sha256"
            ],
            "properties": {
              "versionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          }
        }
      },
      "LmsPreviewLink": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "sessionId",
          "mode",
          "status",
          "target",
          "createdAt",
          "consumedAt",
          "expiresAt",
          "revokedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "OBSERVE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "CONSUMED",
              "REVOKED",
              "EXPIRED"
            ]
          },
          "target": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "moduleKey",
              "lessonKey",
              "itemId"
            ],
            "properties": {
              "moduleKey": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lessonKey": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "itemId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "consumedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "LmsEmployerPreviewLink": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "courseId",
          "courseVersionId",
          "status",
          "createdAt",
          "consumedAt",
          "expiresAt",
          "revokedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "EMPLOYER"
            ]
          },
          "courseId": {
            "type": "string"
          },
          "courseVersionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "CONSUMED",
              "REVOKED",
              "EXPIRED"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "consumedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "VideoLibraryAssetUsage": {
        "type": "object",
        "description": "Live usage summary — counts only, never cross-surface identifiers.",
        "required": [
          "instructionsPageReferences",
          "lmsCourseReferences",
          "messageReferences",
          "releasePins"
        ],
        "additionalProperties": false,
        "properties": {
          "instructionsPageReferences": {
            "type": "integer",
            "minimum": 0,
            "description": "Live (non-detached) draft references on Instructions pages."
          },
          "lmsCourseReferences": {
            "type": "integer",
            "minimum": 0
          },
          "messageReferences": {
            "type": "integer",
            "minimum": 0
          },
          "releasePins": {
            "type": "integer",
            "minimum": 0,
            "description": "Immutable pins (Instructions releases + LMS course versions)."
          }
        }
      },
      "VideoLibraryAsset": {
        "type": "object",
        "description": "One organization-owned private video asset, uploaded once and reused across Instructions pages, LMS lessons, and messages. Provider identifiers and storage internals are never serialized.",
        "required": [
          "id",
          "contractVersion",
          "provider",
          "status",
          "title",
          "originalFileName",
          "mimeType",
          "declaredByteSize",
          "byteSize",
          "durationSeconds",
          "widthPx",
          "heightPx",
          "createdAt",
          "readyAt",
          "archivedAt",
          "errorCode",
          "delegatesToLegacyInstructionAsset",
          "usage"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "contractVersion": {
            "type": "string",
            "enum": [
              "opentrain-video-library/1"
            ],
            "description": "Contract version marker for forward-compatible readers."
          },
          "provider": {
            "type": "string",
            "enum": [
              "CLOUDFLARE_STREAM",
              "SUPABASE_LEGACY"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "READY",
              "ERRORED"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 300
          },
          "originalFileName": {
            "type": [
              "string",
              "null"
            ]
          },
          "mimeType": {
            "type": "string"
          },
          "declaredByteSize": {
            "type": "integer"
          },
          "byteSize": {
            "type": [
              "integer",
              "null"
            ]
          },
          "durationSeconds": {
            "type": [
              "number",
              "null"
            ]
          },
          "widthPx": {
            "type": [
              "integer",
              "null"
            ]
          },
          "heightPx": {
            "type": [
              "integer",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "readyAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "delegatesToLegacyInstructionAsset": {
            "type": "boolean",
            "description": "True when this library identity delegates provider ownership to a legacy Instructions asset (backfilled reuse). Provider identifiers are never exposed on any surface."
          },
          "usage": {
            "$ref": "#/components/schemas/VideoLibraryAssetUsage"
          }
        }
      },
      "VideoLibraryReference": {
        "type": "object",
        "description": "One draft placement of a library asset on a surface. Exactly the fields of the declared surface are non-null.",
        "required": [
          "id",
          "assetId",
          "surface",
          "instructionPageId",
          "instructionNodeId",
          "lmsCourseId",
          "lmsLessonKey",
          "lmsNodeId",
          "jobmessageId",
          "createdAt",
          "detachedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "assetId": {
            "type": "string"
          },
          "surface": {
            "type": "string",
            "enum": [
              "INSTRUCTIONS_PAGE",
              "LMS_COURSE",
              "MESSAGE"
            ]
          },
          "instructionPageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "instructionNodeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "lmsCourseId": {
            "type": [
              "string",
              "null"
            ]
          },
          "lmsLessonKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "lmsNodeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobmessageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "detachedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "VideoLibraryDownload": {
        "type": "object",
        "description": "Download-rendition preparation state for one asset. Row absence is reported as state NONE — never a 404.",
        "required": [
          "assetId",
          "state",
          "percentComplete",
          "readyAt",
          "errorCode"
        ],
        "additionalProperties": false,
        "properties": {
          "assetId": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "NONE",
              "PREPARING",
              "READY",
              "ERRORED"
            ]
          },
          "percentComplete": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "readyAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "errorCode": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "VideoLibraryAssetsListResponse": {
        "type": "object",
        "required": [
          "items",
          "nextCursor",
          "hasMore"
        ],
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VideoLibraryAsset"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "VideoLibraryAssetGetResponse": {
        "type": "object",
        "required": [
          "asset",
          "references",
          "download"
        ],
        "additionalProperties": false,
        "properties": {
          "asset": {
            "$ref": "#/components/schemas/VideoLibraryAsset"
          },
          "references": {
            "type": "object",
            "description": "Live references as a bounded PAGE, never an unbounded array: a video reused across many placements enumerates completely via referencesCursor continuation.",
            "required": [
              "items",
              "nextCursor",
              "hasMore"
            ],
            "additionalProperties": false,
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/VideoLibraryReference"
                }
              },
              "nextCursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hasMore": {
                "type": "boolean"
              }
            }
          },
          "download": {
            "$ref": "#/components/schemas/VideoLibraryDownload"
          }
        }
      },
      "VideoLibraryUploadPrepareRequest": {
        "type": "object",
        "description": "Upload reservation. durationSeconds is required for reservation sizing — clients must probe the file before prepare. The idempotency key travels as the Idempotency-Key header.",
        "required": [
          "fileName",
          "contentType",
          "sizeBytes",
          "durationSeconds"
        ],
        "additionalProperties": false,
        "properties": {
          "fileName": {
            "type": "string",
            "minLength": 1
          },
          "contentType": {
            "type": "string",
            "minLength": 1
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000000000
          },
          "durationSeconds": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 7200
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        }
      },
      "VideoLibraryUploadPrepareResponse": {
        "type": "object",
        "required": [
          "assetId",
          "uploadUrl",
          "chunkBytes",
          "uploadExpiresAt",
          "recovery"
        ],
        "additionalProperties": false,
        "properties": {
          "assetId": {
            "type": "string"
          },
          "uploadUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "ONE-TIME direct-creator TUS URL. Never replayed: an idempotent replay returns uploadUrl null plus recovery paths instead."
          },
          "chunkBytes": {
            "type": "integer"
          },
          "uploadExpiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "recovery": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "reason",
                  "statusPath",
                  "cancelPath"
                ],
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "type": "string",
                    "enum": [
                      "upload_url_not_replayable"
                    ]
                  },
                  "statusPath": {
                    "type": "string",
                    "description": "Canonical /api/public/v1/videos/{assetId}/upload-status path to call verbatim."
                  },
                  "cancelPath": {
                    "type": "string",
                    "description": "Canonical /api/public/v1/videos/{assetId}/cancel-upload path to call verbatim."
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "VideoLibraryUploadStatusResponse": {
        "type": "object",
        "required": [
          "asset",
          "processingPercent",
          "playbackReady"
        ],
        "additionalProperties": false,
        "properties": {
          "asset": {
            "$ref": "#/components/schemas/VideoLibraryAsset"
          },
          "processingPercent": {
            "type": [
              "number",
              "null"
            ],
            "description": "Provider encode progress phase (upload-side truth is the TUS client)."
          },
          "playbackReady": {
            "type": "boolean"
          }
        }
      },
      "VideoLibraryUploadCancelResponse": {
        "type": "object",
        "required": [
          "outcome"
        ],
        "additionalProperties": false,
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "canceled",
              "ready"
            ],
            "description": "Truthful terminal state — `ready` means cancel raced READY, the asset became immutable, and it was kept."
          }
        }
      },
      "VideoLibraryReferenceAttachRequest": {
        "type": "object",
        "description": "Atomic canonical draft-content placement request. The idempotency key travels as the Idempotency-Key header.",
        "required": [
          "assetId",
          "target"
        ],
        "additionalProperties": false,
        "properties": {
          "assetId": {
            "type": "string"
          },
          "target": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "surface",
                  "instructionPageId",
                  "instructionNodeId"
                ],
                "additionalProperties": false,
                "properties": {
                  "surface": {
                    "type": "string",
                    "enum": [
                      "INSTRUCTIONS_PAGE"
                    ]
                  },
                  "instructionPageId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "instructionNodeId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "afterNodeId": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "surface",
                  "lmsCourseId",
                  "lmsLessonKey",
                  "lmsNodeId"
                ],
                "additionalProperties": false,
                "properties": {
                  "surface": {
                    "type": "string",
                    "enum": [
                      "LMS_COURSE"
                    ]
                  },
                  "lmsCourseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "lmsLessonKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,119}$"
                  },
                  "lmsNodeId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "afterNodeId": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            ]
          }
        }
      },
      "VideoLibraryReferenceAttachResponse": {
        "type": "object",
        "required": [
          "reference",
          "jobmessageId",
          "contentCommitted",
          "referenceCommitted",
          "publishPerformed",
          "revisionImpact"
        ],
        "additionalProperties": false,
        "properties": {
          "reference": {
            "$ref": "#/components/schemas/VideoLibraryReference"
          },
          "jobmessageId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Reserved for future atomic MESSAGE send; null for Instructions and LMS."
          },
          "contentCommitted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "referenceCommitted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "publishPerformed": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "revisionImpact": {
            "type": "string",
            "enum": [
              "INSTRUCTIONS_DOCUMENT_SWAPPED",
              "LMS_DRAFT_INCREMENTED",
              "NONE_ALREADY_CONVERGED"
            ]
          }
        }
      },
      "VideoLibraryReferenceDetachResponse": {
        "type": "object",
        "required": [
          "reference",
          "detached",
          "contentCommitted",
          "referenceCommitted",
          "publishPerformed",
          "revisionImpact"
        ],
        "additionalProperties": false,
        "properties": {
          "reference": {
            "$ref": "#/components/schemas/VideoLibraryReference"
          },
          "detached": {
            "type": "boolean",
            "description": "Immutable release/version pins never detach; drafts only."
          },
          "contentCommitted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "referenceCommitted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "publishPerformed": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "revisionImpact": {
            "type": "string",
            "enum": [
              "INSTRUCTIONS_DOCUMENT_SWAPPED",
              "LMS_DRAFT_INCREMENTED",
              "NONE_ALREADY_CONVERGED"
            ]
          }
        }
      },
      "VideoLibraryDownloadPrepareResponse": {
        "type": "object",
        "required": [
          "download"
        ],
        "additionalProperties": false,
        "properties": {
          "download": {
            "$ref": "#/components/schemas/VideoLibraryDownload"
          }
        }
      },
      "VideoLibraryDownloadStatusResponse": {
        "type": "object",
        "required": [
          "download"
        ],
        "additionalProperties": false,
        "properties": {
          "download": {
            "$ref": "#/components/schemas/VideoLibraryDownload"
          }
        }
      },
      "VideoLibraryDownloadGrantRequest": {
        "type": "object",
        "description": "The idempotency key travels as the Idempotency-Key header.",
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "description": "Bounded human-readable audit reason (stored for audit, never logged with PII)."
          }
        }
      },
      "VideoLibraryDownloadGrantResponse": {
        "type": "object",
        "required": [
          "url",
          "expiresAt",
          "grantId",
          "artifact"
        ],
        "additionalProperties": false,
        "properties": {
          "url": {
            "type": "string",
            "description": "Short-lived authorized MP4-rendition URL (expires <= 10 minutes)."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "grantId": {
            "type": "string"
          },
          "artifact": {
            "type": "string",
            "enum": [
              "mp4_rendition"
            ],
            "description": "Contract reminder serialized to every consumer: the downloadable artifact is the provider's highest-quality full playable MP4 rendition, not guaranteed byte-identical source."
          }
        }
      },
      "VideoLibraryPlaybackGetResponse": {
        "type": "object",
        "required": [
          "assetId",
          "playbackReady",
          "embedPath",
          "tokenTtlSeconds"
        ],
        "additionalProperties": false,
        "properties": {
          "assetId": {
            "type": "string"
          },
          "playbackReady": {
            "type": "boolean"
          },
          "embedPath": {
            "type": [
              "string",
              "null"
            ],
            "description": "Surface-agnostic employer playback embed path. Worker playback stays exclusively on each surface's own authorized delivery routes; provider identifiers and raw signed URLs are never exposed."
          },
          "tokenTtlSeconds": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "VideoLibraryTranscriptSearchMatch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "assetId",
          "assetTitle",
          "startSeconds",
          "endSeconds",
          "snippet"
        ],
        "properties": {
          "assetId": {
            "type": "string",
            "minLength": 1
          },
          "assetTitle": {
            "type": "string"
          },
          "startSeconds": {
            "type": "number",
            "minimum": 0,
            "description": "Matching window start, in seconds from the beginning of the video."
          },
          "endSeconds": {
            "type": "number",
            "minimum": 0,
            "description": "Matching window end, in seconds (never before startSeconds)."
          },
          "snippet": {
            "type": "string",
            "maxLength": 240,
            "description": "Plain-text excerpt around the match (ellipses mark trimmed text). Treat as inert text, never markup."
          }
        }
      },
      "VideoLibraryTranscriptSearchResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "nextCursor",
          "hasMore"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/VideoLibraryTranscriptSearchMatch"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistNodeType": {
        "type": "string",
        "enum": [
          "SECTION",
          "CHECKBOX",
          "SINGLE_CHOICE",
          "MULTI_CHOICE",
          "NUMBER",
          "SHORT_TEXT",
          "LONG_TEXT",
          "REPEAT_GROUP"
        ]
      },
      "JobChecklistOption": {
        "type": "object",
        "required": [
          "id",
          "label"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_-]+$",
            "description": "Stable within the node; never reused after removal."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "JobChecklistCondition": {
        "type": "object",
        "required": [
          "ref",
          "op"
        ],
        "additionalProperties": false,
        "properties": {
          "ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Node id of an EARLIER answerable node (preorder, forward-only)."
          },
          "op": {
            "type": "string",
            "enum": [
              "CHECKED",
              "UNCHECKED",
              "EQUALS",
              "NOT_EQUALS",
              "IN",
              "INCLUDES",
              "NOT_INCLUDES",
              "EQ",
              "NEQ",
              "GT",
              "GTE",
              "LT",
              "LTE",
              "ANSWERED",
              "UNANSWERED"
            ]
          },
          "value": {
            "description": "EQUALS/NOT_EQUALS/INCLUDES/NOT_INCLUDES: option id. IN: option ids. EQ..LTE: number. CHECKED/UNCHECKED/ANSWERED/UNANSWERED: omitted.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 25
              }
            ]
          }
        }
      },
      "JobChecklistVisibleWhen": {
        "type": "object",
        "required": [
          "mode",
          "conditions"
        ],
        "additionalProperties": false,
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "ALL",
              "ANY"
            ]
          },
          "conditions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/JobChecklistCondition"
            }
          }
        }
      },
      "JobChecklistNumberConfig": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "integerOnly": {
            "type": "boolean"
          },
          "min": {
            "type": "number"
          },
          "max": {
            "type": "number"
          }
        }
      },
      "JobChecklistRepeatConfig": {
        "type": "object",
        "required": [
          "maxInstances"
        ],
        "additionalProperties": false,
        "properties": {
          "countNodeId": {
            "type": "string",
            "description": "Earlier NUMBER node (outside any repeat) whose answer sets the count."
          },
          "fixedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Exactly one of countNodeId/fixedCount is set."
          },
          "maxInstances": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "instanceLabelText": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "JobChecklistNode": {
        "type": "object",
        "required": [
          "id",
          "text",
          "type"
        ],
        "additionalProperties": false,
        "description": "One adaptive v2 tree node. Ids are stable client-minted URL-safe tokens, never reused after removal (publish enforces historical non-resurrection). Depth ≤ 3; repeats never nest.",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_-]+$"
          },
          "text": {
            "type": "string",
            "maxLength": 500
          },
          "type": {
            "$ref": "#/components/schemas/JobChecklistNodeType"
          },
          "requiredBoolean": {
            "type": "boolean",
            "description": "Answerable nodes only; defaults true."
          },
          "options": {
            "type": "array",
            "minItems": 1,
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/JobChecklistOption"
            }
          },
          "numberConfig": {
            "$ref": "#/components/schemas/JobChecklistNumberConfig"
          },
          "repeatConfig": {
            "$ref": "#/components/schemas/JobChecklistRepeatConfig"
          },
          "visibleWhen": {
            "$ref": "#/components/schemas/JobChecklistVisibleWhen"
          },
          "children": {
            "type": "array",
            "maxItems": 300,
            "items": {
              "$ref": "#/components/schemas/JobChecklistNode"
            },
            "description": "SECTION/CHECKBOX children, or the REPEAT_GROUP template."
          }
        }
      },
      "JobChecklistTree": {
        "type": "array",
        "maxItems": 300,
        "items": {
          "$ref": "#/components/schemas/JobChecklistNode"
        }
      },
      "JobChecklistAnswerValue": {
        "description": "CHECKBOX true; SINGLE_CHOICE option id; MULTI_CHOICE option ids; NUMBER number; SHORT/LONG_TEXT string.",
        "oneOf": [
          {
            "type": "boolean"
          },
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 25
          }
        ]
      },
      "JobChecklistAnswer": {
        "type": "object",
        "required": [
          "v",
          "at"
        ],
        "additionalProperties": false,
        "properties": {
          "v": {
            "$ref": "#/components/schemas/JobChecklistAnswerValue"
          },
          "at": {
            "type": "string",
            "description": "ISO timestamp of the last change."
          }
        }
      },
      "JobChecklistAnswerMap": {
        "type": "object",
        "description": "Answer path -> answer. Paths: `nodeId` or `repeatId[index].nodeId`.",
        "additionalProperties": {
          "$ref": "#/components/schemas/JobChecklistAnswer"
        }
      },
      "JobChecklistValidationIssue": {
        "type": "object",
        "required": [
          "nodeId",
          "message"
        ],
        "additionalProperties": false,
        "properties": {
          "nodeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "JobChecklistPublishImpact": {
        "type": "object",
        "required": [
          "addedNodeIds",
          "removedNodeIds",
          "rewordedNodeIds",
          "configChangedNodeIds",
          "movedNodeIds",
          "staleNodeIds"
        ],
        "additionalProperties": false,
        "properties": {
          "addedNodeIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "removedNodeIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rewordedNodeIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "configChangedNodeIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "movedNodeIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "staleNodeIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Answerable reworded/config-changed nodes whose open-run answers the publish sweep moves to private stale maps."
          }
        }
      },
      "JobChecklistSummary": {
        "type": "object",
        "required": [
          "definitionId",
          "draftTitleText",
          "publishedTitleText",
          "orderNumber",
          "archived",
          "required",
          "draftRequired",
          "publishedVersionNumber",
          "publishedAtIso",
          "hasUnpublishedChanges",
          "submissionCount"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionId": {
            "type": "string"
          },
          "draftTitleText": {
            "type": "string"
          },
          "publishedTitleText": {
            "type": [
              "string",
              "null"
            ]
          },
          "orderNumber": {
            "type": "integer"
          },
          "archived": {
            "type": "boolean"
          },
          "required": {
            "type": "boolean"
          },
          "draftRequired": {
            "type": "boolean"
          },
          "publishedVersionNumber": {
            "type": "integer",
            "minimum": 0
          },
          "publishedAtIso": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasUnpublishedChanges": {
            "type": "boolean"
          },
          "submissionCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobChecklistBuilderDetail": {
        "type": "object",
        "required": [
          "definitionId",
          "jobId",
          "draftTitleText",
          "publishedTitleText",
          "archived",
          "draftRequired",
          "draftTree",
          "draftVersion",
          "draftUpdatedAtIso",
          "publishedVersionNumber",
          "publishedRequired",
          "publishedTree",
          "publishedAtIso",
          "hasUnpublishedChanges",
          "draftIssues",
          "worstCaseActiveNodes",
          "publishImpact"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionId": {
            "type": "string"
          },
          "jobId": {
            "type": "string"
          },
          "draftTitleText": {
            "type": "string"
          },
          "publishedTitleText": {
            "type": [
              "string",
              "null"
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "draftRequired": {
            "type": "boolean"
          },
          "draftTree": {
            "$ref": "#/components/schemas/JobChecklistTree"
          },
          "draftVersion": {
            "type": "integer",
            "minimum": 0,
            "description": "CAS token for draft saves and publish."
          },
          "draftUpdatedAtIso": {
            "type": [
              "string",
              "null"
            ]
          },
          "publishedVersionNumber": {
            "type": "integer",
            "minimum": 0
          },
          "publishedRequired": {
            "type": "boolean"
          },
          "publishedTree": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobChecklistTree"
              },
              {
                "type": "null"
              }
            ]
          },
          "publishedAtIso": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasUnpublishedChanges": {
            "type": "boolean"
          },
          "draftIssues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobChecklistValidationIssue"
            }
          },
          "worstCaseActiveNodes": {
            "type": "integer",
            "minimum": 0
          },
          "publishImpact": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobChecklistPublishImpact"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobChecklistListResponse": {
        "type": "object",
        "required": [
          "jobId",
          "enabled",
          "checklists"
        ],
        "additionalProperties": false,
        "properties": {
          "jobId": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean",
            "description": "Worker-visibility toggle only: definitions stay editable while disabled; enabling is the final activation step."
          },
          "checklists": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobChecklistSummary"
            }
          }
        }
      },
      "JobChecklistGetResponse": {
        "type": "object",
        "required": [
          "checklist"
        ],
        "additionalProperties": false,
        "properties": {
          "checklist": {
            "$ref": "#/components/schemas/JobChecklistBuilderDetail"
          }
        }
      },
      "JobChecklistCreateRequest": {
        "type": "object",
        "required": [
          "jobId",
          "title",
          "required",
          "tree"
        ],
        "additionalProperties": false,
        "description": "One atomic COMPLETE draft. An intentionally empty draft is explicit: required=false, tree=[].",
        "properties": {
          "jobId": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "required": {
            "type": "boolean"
          },
          "tree": {
            "$ref": "#/components/schemas/JobChecklistTree"
          }
        }
      },
      "JobChecklistCreateResponse": {
        "type": "object",
        "required": [
          "checklist",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "checklist": {
            "$ref": "#/components/schemas/JobChecklistBuilderDetail"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistManageRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "action",
              "expectedDraftVersion",
              "required",
              "tree"
            ],
            "additionalProperties": false,
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "update_draft"
                ]
              },
              "expectedDraftVersion": {
                "type": "integer",
                "minimum": 0
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "required": {
                "type": "boolean"
              },
              "tree": {
                "$ref": "#/components/schemas/JobChecklistTree"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "action"
            ],
            "additionalProperties": false,
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "retire",
                  "restore"
                ]
              }
            }
          }
        ]
      },
      "JobChecklistManageResponse": {
        "type": "object",
        "required": [
          "checklist",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "checklist": {
            "$ref": "#/components/schemas/JobChecklistBuilderDetail"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistValidateStoredRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ]
          }
        }
      },
      "JobChecklistValidateInlineRequest": {
        "type": "object",
        "required": [
          "mode",
          "title",
          "required",
          "tree"
        ],
        "additionalProperties": false,
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "inline"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 10000
          },
          "required": {
            "type": "boolean"
          },
          "tree": {
            "$ref": "#/components/schemas/JobChecklistTree"
          },
          "baselineDefinitionId": {
            "type": "string"
          },
          "expectedDraftVersion": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobChecklistValidateResponse": {
        "type": "object",
        "required": [
          "definitionId",
          "source",
          "valid",
          "issues",
          "worstCaseActiveNodes",
          "publishImpact",
          "baseline"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "draft",
              "published",
              "inline"
            ]
          },
          "valid": {
            "type": "boolean"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobChecklistValidationIssue"
            }
          },
          "worstCaseActiveNodes": {
            "type": "integer",
            "minimum": 0
          },
          "publishImpact": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobChecklistPublishImpact"
              },
              {
                "type": "null"
              }
            ]
          },
          "baseline": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "definitionId",
                  "draftVersion",
                  "publishedVersionNumber"
                ],
                "additionalProperties": false,
                "properties": {
                  "definitionId": {
                    "type": "string"
                  },
                  "draftVersion": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "publishedVersionNumber": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "draftVersionMatches": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobChecklistResolveRequest": {
        "type": "object",
        "required": [
          "answers"
        ],
        "additionalProperties": false,
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ]
          },
          "answers": {
            "$ref": "#/components/schemas/JobChecklistAnswerMap"
          }
        }
      },
      "JobChecklistResolvedRow": {
        "type": "object",
        "required": [
          "path",
          "nodeId",
          "kind",
          "node",
          "number",
          "depth",
          "answerable",
          "required"
        ],
        "additionalProperties": false,
        "properties": {
          "path": {
            "type": "string"
          },
          "nodeId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "NODE",
              "REPEAT_INSTANCE"
            ]
          },
          "node": {
            "$ref": "#/components/schemas/JobChecklistNode"
          },
          "number": {
            "type": "string"
          },
          "depth": {
            "type": "integer",
            "minimum": 0
          },
          "instanceLabel": {
            "type": "string"
          },
          "repeatId": {
            "type": "string"
          },
          "instanceIndex": {
            "type": "integer",
            "minimum": 0
          },
          "answerable": {
            "type": "boolean"
          },
          "required": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistResolveOutcome": {
        "type": "object",
        "required": [
          "rows",
          "activeAnswers",
          "answerStates",
          "missingRequiredPaths",
          "invalidAnswers",
          "progress",
          "activeNodeCount"
        ],
        "additionalProperties": false,
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobChecklistResolvedRow"
            }
          },
          "activeAnswers": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JobChecklistAnswerValue"
            }
          },
          "answerStates": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ACTIVE_INVALID",
                "HIDDEN",
                "ORPHANED"
              ]
            }
          },
          "missingRequiredPaths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invalidAnswers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "path",
                "reason"
              ],
              "additionalProperties": false,
              "properties": {
                "path": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                }
              }
            }
          },
          "progress": {
            "type": "object",
            "required": [
              "requiredAnswered",
              "requiredTotal",
              "answered",
              "answerableTotal"
            ],
            "additionalProperties": false,
            "properties": {
              "requiredAnswered": {
                "type": "integer",
                "minimum": 0
              },
              "requiredTotal": {
                "type": "integer",
                "minimum": 0
              },
              "answered": {
                "type": "integer",
                "minimum": 0
              },
              "answerableTotal": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "activeNodeCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobChecklistResolveResponse": {
        "type": "object",
        "required": [
          "definitionId",
          "source",
          "versionNumber",
          "resolve"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionId": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ]
          },
          "versionNumber": {
            "type": [
              "integer",
              "null"
            ]
          },
          "resolve": {
            "$ref": "#/components/schemas/JobChecklistResolveOutcome"
          }
        }
      },
      "JobChecklistPublishRequest": {
        "type": "object",
        "required": [
          "expectedDraftVersion",
          "expectedPublishedVersionNumber",
          "confirmPublish"
        ],
        "additionalProperties": false,
        "properties": {
          "expectedDraftVersion": {
            "type": "integer",
            "minimum": 0
          },
          "expectedPublishedVersionNumber": {
            "type": "integer",
            "minimum": 0
          },
          "confirmPublish": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Acknowledges this changes the live worker surface."
          }
        }
      },
      "JobChecklistPublishApplied": {
        "type": "object",
        "required": [
          "versionNumber",
          "contentHash",
          "impact",
          "sweep"
        ],
        "additionalProperties": false,
        "properties": {
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "contentHash": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "impact": {
            "$ref": "#/components/schemas/JobChecklistPublishImpact"
          },
          "sweep": {
            "type": "object",
            "required": [
              "openRunsSwept",
              "staleAnswersSwept"
            ],
            "additionalProperties": false,
            "properties": {
              "openRunsSwept": {
                "type": "integer",
                "minimum": 0
              },
              "staleAnswersSwept": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      },
      "JobChecklistPublishResponse": {
        "type": "object",
        "required": [
          "checklist",
          "applied",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "checklist": {
            "$ref": "#/components/schemas/JobChecklistBuilderDetail"
          },
          "applied": {
            "$ref": "#/components/schemas/JobChecklistPublishApplied"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistReorderRequest": {
        "type": "object",
        "required": [
          "jobId",
          "orderedDefinitionIds",
          "expectedOrderedDefinitionIds"
        ],
        "additionalProperties": false,
        "properties": {
          "jobId": {
            "type": "string"
          },
          "orderedDefinitionIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 200,
            "items": {
              "type": "string"
            },
            "description": "The complete new order: each definition id exactly once."
          },
          "expectedOrderedDefinitionIds": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "type": "string"
            },
            "description": "The complete current order as last observed (CAS precondition)."
          }
        }
      },
      "JobChecklistReorderResponse": {
        "type": "object",
        "required": [
          "jobId",
          "checklists",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "jobId": {
            "type": "string"
          },
          "checklists": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobChecklistSummary"
            }
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistVersionSummary": {
        "type": "object",
        "required": [
          "versionNumber",
          "titleText",
          "required",
          "contentHash",
          "createdAtIso",
          "publishedByUserId"
        ],
        "additionalProperties": false,
        "properties": {
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "titleText": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "contentHash": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "createdAtIso": {
            "type": "string"
          },
          "publishedByUserId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobChecklistVersionsListResponse": {
        "type": "object",
        "required": [
          "definitionId",
          "versions",
          "nextCursor"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionId": {
            "type": "string"
          },
          "versions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobChecklistVersionSummary"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobChecklistVersionGetResponse": {
        "type": "object",
        "required": [
          "version"
        ],
        "additionalProperties": false,
        "properties": {
          "version": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JobChecklistVersionSummary"
              },
              {
                "type": "object",
                "required": [
                  "definitionId",
                  "schemaVersion",
                  "tree"
                ],
                "properties": {
                  "definitionId": {
                    "type": "string"
                  },
                  "schemaVersion": {
                    "type": "integer"
                  },
                  "tree": {
                    "$ref": "#/components/schemas/JobChecklistTree"
                  }
                }
              }
            ]
          }
        }
      },
      "JobChecklistSubmissionRow": {
        "type": "object",
        "required": [
          "submissionId",
          "definitionId",
          "definitionTitle",
          "userId",
          "userName",
          "externalTaskId",
          "submittedAtIso",
          "versionNumber",
          "answeredCount",
          "requiredCount"
        ],
        "additionalProperties": false,
        "properties": {
          "submissionId": {
            "type": "string"
          },
          "definitionId": {
            "type": "string"
          },
          "definitionTitle": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "userName": {
            "type": "string"
          },
          "externalTaskId": {
            "type": "string"
          },
          "submittedAtIso": {
            "type": "string"
          },
          "versionNumber": {
            "type": "integer",
            "minimum": 1
          },
          "answeredCount": {
            "type": "integer",
            "minimum": 0
          },
          "requiredCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobChecklistSubmissionsListResponse": {
        "type": "object",
        "required": [
          "submissions",
          "page",
          "hasMore"
        ],
        "additionalProperties": false,
        "properties": {
          "submissions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobChecklistSubmissionRow"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistSubmissionGetResponse": {
        "type": "object",
        "required": [
          "submission"
        ],
        "additionalProperties": false,
        "properties": {
          "submission": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JobChecklistSubmissionRow"
              },
              {
                "type": "object",
                "required": [
                  "tree",
                  "required",
                  "activeAnswers",
                  "inactiveAudit"
                ],
                "properties": {
                  "tree": {
                    "$ref": "#/components/schemas/JobChecklistTree"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "activeAnswers": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JobChecklistAnswerValue"
                    }
                  },
                  "inactiveAudit": {
                    "type": "array",
                    "description": "Evidence of exclusion only: never raw values, never value hashes.",
                    "items": {
                      "type": "object",
                      "required": [
                        "path",
                        "state",
                        "nodeId"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "nodeId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            ]
          }
        }
      },
      "JobChecklistSetEnabledRequest": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "confirmDisable": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Required when enabled=false: workers lose the checklist surface."
          }
        }
      },
      "JobChecklistSetEnabledResponse": {
        "type": "object",
        "required": [
          "jobId",
          "enabled",
          "replayed"
        ],
        "additionalProperties": false,
        "properties": {
          "jobId": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobChecklistCapabilitiesResponse": {
        "type": "object",
        "required": [
          "family",
          "operations",
          "limits",
          "job"
        ],
        "additionalProperties": false,
        "properties": {
          "family": {
            "type": "string",
            "enum": [
              "job_checklists"
            ]
          },
          "operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limits": {
            "type": "object",
            "required": [
              "maxDepth",
              "maxNodes",
              "maxOptions",
              "maxClauses",
              "maxActiveNodes",
              "repeatHardMax",
              "answersMaxBytes"
            ],
            "additionalProperties": false,
            "properties": {
              "maxDepth": {
                "type": "integer"
              },
              "maxNodes": {
                "type": "integer"
              },
              "maxOptions": {
                "type": "integer"
              },
              "maxClauses": {
                "type": "integer"
              },
              "maxActiveNodes": {
                "type": "integer"
              },
              "repeatHardMax": {
                "type": "integer"
              },
              "answersMaxBytes": {
                "type": "integer"
              }
            }
          },
          "job": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "jobId",
                  "enabled"
                ],
                "additionalProperties": false,
                "properties": {
                  "jobId": {
                    "type": "string"
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobChecklistPreviewGrantRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "source",
              "expectedDraftVersion"
            ],
            "additionalProperties": false,
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "draft"
                ]
              },
              "expectedDraftVersion": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "source",
              "versionNumber"
            ],
            "additionalProperties": false,
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "published"
                ]
              },
              "versionNumber": {
                "type": "integer",
                "minimum": 1
              }
            }
          },
          {
            "type": "object",
            "required": [
              "source"
            ],
            "additionalProperties": false,
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "published-latest"
                ]
              }
            }
          }
        ]
      },
      "JobChecklistPreviewGrantResponse": {
        "type": "object",
        "required": [
          "definitionId",
          "source",
          "draftVersion",
          "versionNumber",
          "contentHash",
          "previewUrl",
          "expiresAtIso"
        ],
        "additionalProperties": false,
        "properties": {
          "definitionId": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ]
          },
          "draftVersion": {
            "type": [
              "integer",
              "null"
            ]
          },
          "versionNumber": {
            "type": [
              "integer",
              "null"
            ]
          },
          "contentHash": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "previewUrl": {
            "type": "string",
            "description": "Complete browser URL whose FRAGMENT carries the short-lived signed capability (never query strings or access logs). Open directly."
          },
          "expiresAtIso": {
            "type": "string"
          }
        }
      },
      "JobFeedbackSeverity": {
        "type": "string",
        "enum": [
          "MINOR",
          "MODERATE",
          "MAJOR",
          "CRITICAL"
        ]
      },
      "JobFeedbackStatus": {
        "type": "string",
        "description": "Lifecycle: OPEN → IN_REVIEW → ACTIONED | DISMISSED (terminal states can reopen to IN_REVIEW with a note).",
        "enum": [
          "OPEN",
          "IN_REVIEW",
          "ACTIONED",
          "DISMISSED"
        ]
      },
      "JobFeedbackSuggestedAction": {
        "type": "string",
        "description": "Recommendation only — nothing ever executes automatically. null = no suggestion.",
        "enum": [
          "WARNING",
          "RETRAINING",
          "OFFBOARDING"
        ]
      },
      "JobFeedbackAssessment": {
        "type": "string",
        "description": "DEV-3168 balanced overall assessment. Legacy rows submitted before assessments existed read as NEEDS_IMPROVEMENT.",
        "enum": [
          "POSITIVE",
          "MIXED",
          "NEEDS_IMPROVEMENT"
        ]
      },
      "JobFeedbackPerformanceRating": {
        "type": "string",
        "description": "Optional anchored rating; null = Not rated.",
        "enum": [
          "BELOW_EXPECTATIONS",
          "MEETS_EXPECTATIONS",
          "EXCEEDS_EXPECTATIONS"
        ]
      },
      "JobFeedbackKnowledgeRating": {
        "type": "string",
        "description": "Optional anchored rating; null = Not rated.",
        "enum": [
          "GAPS_EVIDENT",
          "SOLID_UNDERSTANDING",
          "DEEP_UNDERSTANDING"
        ]
      },
      "JobFeedbackAssessmentCounts": {
        "type": "object",
        "description": "Legacy NULL assessments count as NEEDS_IMPROVEMENT.",
        "required": [
          "POSITIVE",
          "MIXED",
          "NEEDS_IMPROVEMENT"
        ],
        "additionalProperties": false,
        "properties": {
          "POSITIVE": {
            "type": "integer"
          },
          "MIXED": {
            "type": "integer"
          },
          "NEEDS_IMPROVEMENT": {
            "type": "integer"
          }
        }
      },
      "JobFeedbackPerformanceRatingSummary": {
        "type": "object",
        "description": "Sparse-honest rating view: distribution + latest anchored label + rated-n-of-m. Ratings are optional and self-selected — never average, score, or rank them.",
        "required": [
          "distribution",
          "ratedCount",
          "latest"
        ],
        "properties": {
          "distribution": {
            "type": "object",
            "required": [
              "BELOW_EXPECTATIONS",
              "MEETS_EXPECTATIONS",
              "EXCEEDS_EXPECTATIONS"
            ],
            "additionalProperties": false,
            "properties": {
              "BELOW_EXPECTATIONS": {
                "type": "integer"
              },
              "MEETS_EXPECTATIONS": {
                "type": "integer"
              },
              "EXCEEDS_EXPECTATIONS": {
                "type": "integer"
              }
            }
          },
          "ratedCount": {
            "type": "integer"
          },
          "latest": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "rating",
                  "atIso"
                ],
                "properties": {
                  "rating": {
                    "$ref": "#/components/schemas/JobFeedbackPerformanceRating"
                  },
                  "atIso": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobFeedbackKnowledgeRatingSummary": {
        "type": "object",
        "description": "Sparse-honest rating view: distribution + latest anchored label + rated-n-of-m. Ratings are optional and self-selected — never average, score, or rank them.",
        "required": [
          "distribution",
          "ratedCount",
          "latest"
        ],
        "properties": {
          "distribution": {
            "type": "object",
            "required": [
              "GAPS_EVIDENT",
              "SOLID_UNDERSTANDING",
              "DEEP_UNDERSTANDING"
            ],
            "additionalProperties": false,
            "properties": {
              "GAPS_EVIDENT": {
                "type": "integer"
              },
              "SOLID_UNDERSTANDING": {
                "type": "integer"
              },
              "DEEP_UNDERSTANDING": {
                "type": "integer"
              }
            }
          },
          "ratedCount": {
            "type": "integer"
          },
          "latest": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "rating",
                  "atIso"
                ],
                "properties": {
                  "rating": {
                    "$ref": "#/components/schemas/JobFeedbackKnowledgeRating"
                  },
                  "atIso": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobFeedbackReport": {
        "type": "object",
        "required": [
          "id",
          "createdAtIso",
          "updatedAtIso",
          "jobId",
          "reporterUserId",
          "reporterName",
          "subjectUserId",
          "subjectName",
          "subjectContractId",
          "subjectContractEnded",
          "subjectMaskedLabel",
          "externalTrainerId",
          "externalTaskId",
          "assessment",
          "hasConcern",
          "overallPerformance",
          "knowledgeUnderstanding",
          "severity",
          "status",
          "report",
          "suggestedAction",
          "resolutionNote",
          "resolvedAtIso"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAtIso": {
            "type": "string"
          },
          "updatedAtIso": {
            "type": "string",
            "description": "Concurrency token: echo as expectedUpdatedAt when triaging."
          },
          "jobId": {
            "type": "string"
          },
          "reporterUserId": {
            "type": "string"
          },
          "reporterName": {
            "type": "string"
          },
          "subjectUserId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Canonical subject person; null only on legacy unlinked reports."
          },
          "subjectName": {
            "type": [
              "string",
              "null"
            ]
          },
          "subjectContractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "subjectContractEnded": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "subjectMaskedLabel": {
            "type": [
              "string",
              "null"
            ],
            "description": "Worker-safe masked subject label derived from the subject contract id."
          },
          "externalTrainerId": {
            "type": "string",
            "description": "The reviewer's external/masked AI Trainer ID exactly as entered."
          },
          "externalTaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assessment": {
            "$ref": "#/components/schemas/JobFeedbackAssessment"
          },
          "hasConcern": {
            "type": "boolean",
            "description": "False = Recorded row: outside the triage lifecycle. Its severity is a storage compatibility shadow (MINOR) and its status stays OPEN — key every decision off hasConcern and present the row as 'Recorded'."
          },
          "overallPerformance": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackPerformanceRating"
              },
              {
                "type": "null"
              }
            ]
          },
          "knowledgeUnderstanding": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackKnowledgeRating"
              },
              {
                "type": "null"
              }
            ]
          },
          "severity": {
            "$ref": "#/components/schemas/JobFeedbackSeverity"
          },
          "status": {
            "$ref": "#/components/schemas/JobFeedbackStatus"
          },
          "report": {
            "type": "string",
            "description": "May be empty on Recorded rows."
          },
          "suggestedAction": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackSuggestedAction"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolutionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolvedAtIso": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobFeedbackEvent": {
        "type": "object",
        "required": [
          "id",
          "atIso",
          "actorUserId",
          "actorName",
          "event",
          "fromStatus",
          "toStatus",
          "note"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "atIso": {
            "type": "string"
          },
          "actorUserId": {
            "type": "string"
          },
          "actorName": {
            "type": "string"
          },
          "event": {
            "type": "string",
            "enum": [
              "SUBMITTED",
              "STATUS_CHANGED",
              "SUBJECT_LINKED"
            ]
          },
          "fromStatus": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "toStatus": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobFeedbackStatusCounts": {
        "type": "object",
        "required": [
          "OPEN",
          "IN_REVIEW",
          "ACTIONED",
          "DISMISSED"
        ],
        "additionalProperties": false,
        "properties": {
          "OPEN": {
            "type": "integer"
          },
          "IN_REVIEW": {
            "type": "integer"
          },
          "ACTIONED": {
            "type": "integer"
          },
          "DISMISSED": {
            "type": "integer"
          }
        }
      },
      "JobFeedbackListResponse": {
        "type": "object",
        "required": [
          "reports",
          "page",
          "hasMore",
          "counts",
          "recordedCount",
          "assessmentCounts"
        ],
        "properties": {
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFeedbackReport"
            }
          },
          "page": {
            "type": "integer"
          },
          "hasMore": {
            "type": "boolean"
          },
          "counts": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackStatusCounts"
              }
            ],
            "description": "Authoritative CONCERN-lane per-status counts scoped by jobId + subject only (search/severity/date filters do not change them). Recorded rows never appear here."
          },
          "recordedCount": {
            "type": "integer",
            "description": "Recorded-lane (non-concern) size for the subject-filtered set."
          },
          "assessmentCounts": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackAssessmentCounts"
              }
            ],
            "description": "Assessment counts for the subject-filtered set."
          }
        }
      },
      "JobFeedbackDetailResponse": {
        "type": "object",
        "required": [
          "report",
          "events"
        ],
        "properties": {
          "report": {
            "$ref": "#/components/schemas/JobFeedbackReport"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFeedbackEvent"
            },
            "description": "Append-only lifecycle trail, oldest first (employer-only read)."
          }
        }
      },
      "JobFeedbackPersonSummary": {
        "type": "object",
        "required": [
          "subjectUserId",
          "subjectName",
          "reportCount",
          "unresolvedCount",
          "lastReportAtIso",
          "assessmentCounts",
          "performance",
          "knowledge"
        ],
        "properties": {
          "subjectUserId": {
            "type": "string"
          },
          "subjectName": {
            "type": "string"
          },
          "reportCount": {
            "type": "integer"
          },
          "unresolvedCount": {
            "type": "integer",
            "description": "CONCERN rows awaiting triage (OPEN/IN_REVIEW). Recorded rows never count here."
          },
          "lastReportAtIso": {
            "type": "string"
          },
          "assessmentCounts": {
            "$ref": "#/components/schemas/JobFeedbackAssessmentCounts"
          },
          "performance": {
            "$ref": "#/components/schemas/JobFeedbackPerformanceRatingSummary"
          },
          "knowledge": {
            "$ref": "#/components/schemas/JobFeedbackKnowledgeRatingSummary"
          }
        }
      },
      "JobFeedbackSummaryResponse": {
        "type": "object",
        "required": [
          "totalCount",
          "unresolvedCount",
          "statusCounts",
          "recordedCount",
          "assessmentCounts",
          "people",
          "unlinkedCount"
        ],
        "properties": {
          "totalCount": {
            "type": "integer"
          },
          "unresolvedCount": {
            "type": "integer",
            "description": "CONCERN rows awaiting triage only."
          },
          "statusCounts": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackStatusCounts"
              }
            ],
            "description": "Status counts over CONCERN rows only."
          },
          "recordedCount": {
            "type": "integer",
            "description": "The Recorded lane (positive / unflagged mixed) size."
          },
          "assessmentCounts": {
            "$ref": "#/components/schemas/JobFeedbackAssessmentCounts"
          },
          "people": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFeedbackPersonSummary"
            }
          },
          "unlinkedCount": {
            "type": "integer",
            "description": "Legacy reports not yet linked to a canonical person."
          }
        }
      },
      "JobFeedbackSubmitRequest": {
        "type": "object",
        "description": "DEV-3168 balanced shapes: omit assessment (legacy) and severity + report stay REQUIRED, recording a NEEDS_IMPROVEMENT concern. With assessment, severity present <=> a concern is flagged — POSITIVE never takes severity/suggestedAction, NEEDS_IMPROVEMENT requires severity, MIXED takes severity only when flagging, and any flagged concern requires a nonblank report.",
        "additionalProperties": false,
        "required": [
          "jobId",
          "subjectUserId"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "subjectUserId": {
            "type": "string"
          },
          "subjectContractId": {
            "type": "string"
          },
          "externalTrainerId": {
            "type": "string",
            "maxLength": 128
          },
          "externalTaskId": {
            "type": "string",
            "maxLength": 128
          },
          "assessment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackAssessment"
              }
            ],
            "description": "Omit for the legacy concern shape (severity + report required)."
          },
          "severity": {
            "allOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackSeverity"
              }
            ],
            "description": "Present <=> the submission flags a concern (enters the triage lane)."
          },
          "suggestedAction": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackSuggestedAction"
              },
              {
                "type": "null"
              }
            ]
          },
          "report": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000,
            "description": "The ONE feedback body; required whenever a concern is flagged."
          },
          "overallPerformance": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackPerformanceRating"
              },
              {
                "type": "null"
              }
            ]
          },
          "knowledgeUnderstanding": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobFeedbackKnowledgeRating"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "JobFeedbackReportMutationResponse": {
        "type": "object",
        "required": [
          "report",
          "replayed"
        ],
        "properties": {
          "report": {
            "$ref": "#/components/schemas/JobFeedbackReport"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobFeedbackTriageRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "toStatus",
          "expectedUpdatedAt"
        ],
        "properties": {
          "toStatus": {
            "$ref": "#/components/schemas/JobFeedbackStatus"
          },
          "note": {
            "type": "string",
            "maxLength": 2000,
            "description": "Required by the domain when completing (ACTIONED), closing (DISMISSED), or reopening a terminal report."
          },
          "expectedUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "maxLength": 40,
            "description": "The report's updatedAtIso as loaded — a mismatch is a typed 409 (the report changed since you loaded it). Full ISO-8601 timestamp; date-only strings are a 400."
          }
        }
      },
      "JobFeedbackLinkSubjectRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subjectUserId"
        ],
        "properties": {
          "subjectUserId": {
            "type": "string"
          },
          "subjectContractId": {
            "type": "string"
          },
          "note": {
            "type": "string",
            "maxLength": 2000
          }
        }
      },
      "JobFeedbackRosterContract": {
        "type": "object",
        "required": [
          "contractId",
          "contractEnded",
          "createdAtIso"
        ],
        "properties": {
          "contractId": {
            "type": "string"
          },
          "contractEnded": {
            "type": "boolean"
          },
          "createdAtIso": {
            "type": "string"
          }
        }
      },
      "JobFeedbackRosterEntry": {
        "type": "object",
        "required": [
          "userId",
          "userName",
          "contracts",
          "hasActiveContract"
        ],
        "properties": {
          "userId": {
            "type": "string"
          },
          "userName": {
            "type": "string"
          },
          "contracts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFeedbackRosterContract"
            },
            "description": "All contracts for the person — rehires appear as ONE person, never duplicated."
          },
          "hasActiveContract": {
            "type": "boolean"
          }
        }
      },
      "JobFeedbackRosterResponse": {
        "type": "object",
        "required": [
          "jobId",
          "people"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "people": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFeedbackRosterEntry"
            }
          }
        }
      },
      "JobFeedbackReviewerAccessEntry": {
        "type": "object",
        "required": [
          "userId",
          "userName",
          "email",
          "contractId",
          "hasActiveGrant",
          "grantedAtIso",
          "revokedAtIso"
        ],
        "properties": {
          "userId": {
            "type": "string"
          },
          "userName": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "contractId": {
            "type": "string"
          },
          "hasActiveGrant": {
            "type": "boolean"
          },
          "grantedAtIso": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedAtIso": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobFeedbackReviewerAccessListResponse": {
        "type": "object",
        "required": [
          "jobId",
          "entries"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFeedbackReviewerAccessEntry"
            },
            "description": "Unique people with an ACTIVE contract on the job plus their explicit grant state (reviewer submission is active-contract-only)."
          }
        }
      },
      "JobFeedbackReviewerAccessSetRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "userId",
          "grant"
        ],
        "properties": {
          "userId": {
            "type": "string"
          },
          "grant": {
            "type": "boolean"
          }
        }
      },
      "JobFeedbackReviewerAccessSetResponse": {
        "type": "object",
        "required": [
          "jobId",
          "userId",
          "grant",
          "replayed"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "grant": {
            "type": "boolean"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobFeedbackReviewerAccessBulkRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "userIds",
          "grant"
        ],
        "properties": {
          "userIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "maxItems": 200
          },
          "grant": {
            "type": "boolean"
          }
        }
      },
      "JobFeedbackReviewerAccessBulkResponse": {
        "type": "object",
        "required": [
          "jobId",
          "grant",
          "updatedCount",
          "replayed"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "grant": {
            "type": "boolean"
          },
          "updatedCount": {
            "type": "integer"
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "JobFeedbackSettingsResponse": {
        "type": "object",
        "required": [
          "jobId",
          "enabled"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "JobFeedbackSetEnabledRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "enabled",
          "confirm"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "confirm": {
            "type": "boolean",
            "const": true,
            "description": "Required in BOTH directions — the switch changes a live product surface."
          }
        }
      },
      "JobFeedbackSetEnabledResponse": {
        "type": "object",
        "required": [
          "jobId",
          "enabled",
          "replayed"
        ],
        "properties": {
          "jobId": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean",
            "description": "The toggle state committed by THIS receipt (replays return the original outcome)."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "PublicApiRestrictedAddOnState": {
        "type": "object",
        "additionalProperties": false,
        "description": "Coarse live state of the canonical-admin restricted add-on stored on a Full access key (K1.1). `stored` says the key carries the add-on; `effective` says whether THIS request’s re-evaluation of the live canonical-admin policy granted the restricted scope set. Never a policy prong, organization id, or allowlist detail.",
        "required": [
          "stored",
          "effective",
          "reason"
        ],
        "properties": {
          "stored": {
            "type": "boolean"
          },
          "effective": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "restricted_add_on_ineligible",
              null
            ]
          }
        }
      },
      "PublicApiTokenPolicyExclusion": {
        "type": "object",
        "additionalProperties": false,
        "description": "A deliberate withholding: the concrete public scopes this key does NOT have right now, the structural reason, and the exact safe next step (null when nothing the caller does changes it).",
        "required": [
          "reason",
          "scopes",
          "remediation"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "operator_only",
              "worker_lane_only",
              "worker_scope_retired",
              "employer_lane_only",
              "explicit_mint_only",
              "restricted_not_granted",
              "restricted_add_on_ineligible"
            ]
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "remediation": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicApiTokenPolicyMutation": {
        "type": "object",
        "additionalProperties": false,
        "description": "The mutation boundary: `available` is the literal false — no public API, CLI, or MCP operation edits a key policy. `surface` names where a human edits it (the session-authenticated Employer Settings ceremony) or `none` for fixed-policy freelancer and device credentials.",
        "required": [
          "available",
          "surface",
          "reason",
          "remediation"
        ],
        "properties": {
          "available": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "surface": {
            "type": "string",
            "enum": [
              "employer_settings",
              "none"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "session_only",
              "worker_fixed_policy",
              "device_token"
            ]
          },
          "remediation": {
            "type": "string"
          }
        }
      },
      "PublicApiTokenPolicyDiagnostics": {
        "type": "object",
        "additionalProperties": false,
        "description": "Read-only policy discovery for the presented personal API token (DEV-2544 K1.2). `scopes.inherited`, `scopes.explicit`, and `scopes.restrictedAddOn` are disjoint and their union is exactly the effective `token.scopes`; `exclusions` lists what is deliberately withheld and why; `mutation` states that policy editing is never available through the API, CLI, or MCP server and where a human does it instead.",
        "required": [
          "accessMode",
          "inheritsFutureScopes",
          "scopes",
          "restrictedAddOn",
          "exclusions",
          "mutation"
        ],
        "properties": {
          "accessMode": {
            "type": "string",
            "enum": [
              "full_access",
              "worker_full_access",
              "fine_grained"
            ]
          },
          "inheritsFutureScopes": {
            "type": "boolean",
            "description": "True when the access mode expands live against the registry, so scopes added later are covered automatically."
          },
          "scopes": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "inherited",
              "explicit",
              "restrictedAddOn"
            ],
            "properties": {
              "inherited": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "explicit": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "restrictedAddOn": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "restrictedAddOn": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicApiRestrictedAddOnState"
              },
              {
                "type": "null"
              }
            ]
          },
          "exclusions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicApiTokenPolicyExclusion"
            }
          },
          "mutation": {
            "$ref": "#/components/schemas/PublicApiTokenPolicyMutation"
          }
        }
      },
      "CandidateContactRedaction": {
        "type": "object",
        "additionalProperties": false,
        "description": "DEV-2847: field-level proof that candidate-authored free text was contact-sanitized. Carries the field path, category, explicit replacement token, occurrence count, and truthful source — never the removed value. DEV-3129: source EMPLOYER_REVIEW marks an employer-authored review comment; kind LINK ([REDACTED_LINK]) appears only with that source.",
        "properties": {
          "field": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "EMAIL",
              "PHONE",
              "PHYSICAL_ADDRESS",
              "CONTACT_HANDLE",
              "LINK"
            ]
          },
          "replacement": {
            "type": "string",
            "enum": [
              "[REDACTED_EMAIL]",
              "[REDACTED_PHONE]",
              "[REDACTED_PHYSICAL_ADDRESS]",
              "[REDACTED_CONTACT_HANDLE]",
              "[REDACTED_LINK]"
            ]
          },
          "count": {
            "type": "integer",
            "minimum": 1
          },
          "source": {
            "type": "string",
            "enum": [
              "CANDIDATE_PROFILE",
              "AI_INTERVIEW",
              "EMPLOYER_REVIEW"
            ]
          }
        },
        "required": [
          "field",
          "kind",
          "replacement",
          "count",
          "source"
        ]
      },
      "TalentCard": {
        "type": "object",
        "description": "Privacy-safe aggregate talent card: masked display name, public profile basics, portable reputation, and badges. Never includes contact details, per-task content, or per-buyer breakdowns. Candidate-authored card text is contact-sanitized at response time with explicit [REDACTED_*] placeholders; `redactions` carries field-level provenance (always stamped on API responses, including [], and never persisted in index payloads).",
        "properties": {
          "userId": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "profilePath": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "talentType": {
            "type": "string",
            "enum": [
              "Individual",
              "Agency"
            ],
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "bio": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "countryCode": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "profilePhotoUrl": {
            "type": "string",
            "nullable": true
          },
          "hourlyRateUsd": {
            "type": "number",
            "nullable": true
          },
          "hourlyRateStatus": {
            "type": "string",
            "enum": [
              "VALID",
              "MISSING",
              "INVALID_RATE_DATA"
            ],
            "description": "DEV-3025 rate integrity: INVALID_RATE_DATA means the stored value fell outside the canonical 1..1000 USD / 2-decimal shape and hourlyRateUsd is null."
          },
          "availability": {
            "type": "string",
            "nullable": true
          },
          "expertiseLevel": {
            "type": "string",
            "nullable": true
          },
          "englishLevel": {
            "type": "string",
            "nullable": true
          },
          "memberSince": {
            "type": "string",
            "format": "date-time"
          },
          "skills": {
            "type": "object",
            "properties": {
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "subjectMatter": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "software": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "dataTypes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "labelTypes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "redactions": {
            "type": "array",
            "description": "DEV-2847: response-time contact-redaction provenance for candidate-authored card text. Stamped on every API response (including []); never persisted in index payloads.",
            "items": {
              "$ref": "#/components/schemas/CandidateContactRedaction"
            }
          },
          "reputation": {
            "type": "object",
            "nullable": true,
            "description": "Portable reputation: Bayesian-shrunk fixed-weight composite (0–100) + component estimates. Identical for every caller.",
            "properties": {
              "compositeScore": {
                "type": "number"
              },
              "confidenceTier": {
                "type": "string",
                "enum": [
                  "PROVISIONAL",
                  "ESTABLISHED",
                  "PROVEN"
                ]
              },
              "quality": {
                "type": "object",
                "properties": {
                  "goldAccuracy": {
                    "type": "number",
                    "nullable": true
                  },
                  "verdictAcceptRate": {
                    "type": "number",
                    "nullable": true
                  },
                  "consensusSimilarity": {
                    "type": "number",
                    "nullable": true
                  }
                }
              },
              "reviewStarsMean": {
                "type": "number",
                "nullable": true
              },
              "reviewCount": {
                "type": "integer"
              },
              "volumeUnitsCount": {
                "type": "integer"
              },
              "distinctBuyersCount": {
                "type": "integer"
              },
              "lastSignalAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "computedAt": {
                "type": "string",
                "format": "date-time"
              },
              "formulaVersion": {
                "type": "integer"
              }
            }
          },
          "badges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "domain": {
                  "type": "string",
                  "nullable": true
                },
                "issuedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          }
        }
      },
      "PlatformEvent": {
        "description": "One account event envelope, discriminated by `type` (F-SVE-038): the three verification lifecycle types and the nine quiz to-do lifecycle types (`project_todo.quiz.*`, DEV-2678 S6) carry typed payloads a generated client can narrow structurally; every other type carries an IDs-only object.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/VerificationCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/TrustTierChangedEvent"
          },
          {
            "$ref": "#/components/schemas/VerificationRecheckDueEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizAssignedEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizReminderDueEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizAttemptSubmittedEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizGradingRequiredEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizGradedEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizResultReleasedEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizPassedEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizFailedEvent"
          },
          {
            "$ref": "#/components/schemas/ProjectTodoQuizTodoCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/GenericPlatformEvent"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "verification.completed": "#/components/schemas/VerificationCompletedEvent",
            "trust.tier_changed": "#/components/schemas/TrustTierChangedEvent",
            "verification.recheck_due": "#/components/schemas/VerificationRecheckDueEvent",
            "project_todo.quiz.assigned": "#/components/schemas/ProjectTodoQuizAssignedEvent",
            "project_todo.quiz.reminder_due": "#/components/schemas/ProjectTodoQuizReminderDueEvent",
            "project_todo.quiz.attempt_submitted": "#/components/schemas/ProjectTodoQuizAttemptSubmittedEvent",
            "project_todo.quiz.grading_required": "#/components/schemas/ProjectTodoQuizGradingRequiredEvent",
            "project_todo.quiz.graded": "#/components/schemas/ProjectTodoQuizGradedEvent",
            "project_todo.quiz.result_released": "#/components/schemas/ProjectTodoQuizResultReleasedEvent",
            "project_todo.quiz.passed": "#/components/schemas/ProjectTodoQuizPassedEvent",
            "project_todo.quiz.failed": "#/components/schemas/ProjectTodoQuizFailedEvent",
            "project_todo.quiz.todo_completed": "#/components/schemas/ProjectTodoQuizTodoCompletedEvent"
          }
        }
      },
      "PlatformEventBase": {
        "type": "object",
        "required": [
          "id",
          "apiVersion",
          "createdAt",
          "resourceId"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Monotonic event id; also the pagination cursor"
          },
          "apiVersion": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "resourceId": {
            "type": "string",
            "description": "Primary resource id (proposal, message, contract, milestone, invoice, approval, verification record, or user id depending on type)"
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "VerificationCompletedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "verification.completed"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/VerificationCompletedEventPayload"
              }
            }
          }
        ]
      },
      "TrustTierChangedEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "trust.tier_changed"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/TrustTierChangedEventPayload"
              }
            }
          }
        ]
      },
      "VerificationRecheckDueEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "verification.recheck_due"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/VerificationRecheckDueEventPayload"
              }
            }
          }
        ]
      },
      "GenericPlatformEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformEventBase"
          },
          {
            "type": "object",
            "required": [
              "type",
              "data"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "proposal.received",
                  "proposal.status_changed",
                  "message.received",
                  "contract.created",
                  "milestone.status_changed",
                  "payment.pending",
                  "approval.confirmed",
                  "contract.budget_state_changed",
                  "open_label.task_stage_changed",
                  "time_entry.logged",
                  "time_entry.updated",
                  "timesheet.submitted",
                  "pilot.round_decided",
                  "eval.graded",
                  "eval.completed",
                  "eval.gate_failed",
                  "benchmark.run.completed",
                  "benchmark.access.purchased",
                  "synthetic.verify_completed",
                  "synthetic.run_completed",
                  "training_run.status_changed"
                ]
              },
              "data": {
                "type": "object",
                "additionalProperties": true,
                "description": "IDs-only payload — fetch full resources via their endpoints"
              }
            }
          }
        ]
      },
      "VerificationCompletedEventPayload": {
        "type": "object",
        "description": "Payload for `verification.completed` (verdict-only): a verification record reached a terminal state. `verifiedAt`/`expiresAt` are the validity window — replayed deliveries keep the ORIGINAL verification time (the event row `createdAt` is insertion time, not verdict time).",
        "required": [
          "recordId",
          "kind",
          "status",
          "method",
          "source",
          "verifiedAt",
          "expiresAt"
        ],
        "properties": {
          "recordId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "IDENTITY",
              "EDUCATION",
              "EMPLOYMENT",
              "LICENSE",
              "BACKGROUND"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "APPROVED",
              "REJECTED",
              "EXPIRED",
              "CANCELED"
            ]
          },
          "method": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "DOCUMENT",
              "DOCUMENT_BIOMETRIC",
              "MANUAL_REVIEW",
              null
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "WEBHOOK",
              "PULL",
              "MANUAL"
            ]
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "TrustTierChangedEventPayload": {
        "type": "object",
        "description": "Payload for `trust.tier_changed`: the worker's cached trust tier transitioned. `previousTier` chains are coherent — each event's `previousTier` is the last tier the feed announced.",
        "required": [
          "previousTier",
          "tier"
        ],
        "properties": {
          "previousTier": {
            "type": "string",
            "enum": [
              "UNVERIFIED",
              "IDENTITY_VERIFIED",
              "CREDENTIAL_VERIFIED",
              "TRUSTED"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "UNVERIFIED",
              "IDENTITY_VERIFIED",
              "CREDENTIAL_VERIFIED",
              "TRUSTED"
            ]
          }
        }
      },
      "VerificationRecheckDueEventPayload": {
        "type": "object",
        "description": "Payload for `verification.recheck_due`: approved evidence is entering its expiry window (every expiring kind, including BACKGROUND clearances) or a buyer-configured identity re-check cadence lapsed — re-verify before gating trips.",
        "required": [
          "recordId",
          "kind",
          "verifiedAt",
          "expiresAt"
        ],
        "properties": {
          "recordId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "IDENTITY",
              "EDUCATION",
              "EMPLOYMENT",
              "LICENSE",
              "BACKGROUND"
            ]
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Null for cadence-lapse notices (the evidence itself is not expiring)."
          }
        }
      },
      "Approval": {
        "type": "object",
        "required": [
          "id",
          "type",
          "status",
          "approvalUrl",
          "expiresAt",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "milestone_fund",
              "milestone_approve",
              "contract_end",
              "proposal_hire"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "declined",
              "expired"
            ],
            "description": "pending = waiting for a signed-in human; confirmed = the human approved and the action executed; declined = the human rejected it; expired = nobody acted before expiresAt."
          },
          "contractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "milestoneId": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvalUrl": {
            "type": "string",
            "description": "Deep link a signed-in human (employer account owner or team member) must open and confirm before the action executes. Share this URL with the human."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "resolvedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "result": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Outcome payload populated when the approval is confirmed and executed"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApprovalRequest": {
        "type": "object",
        "required": [
          "approval",
          "message"
        ],
        "description": "Returned with HTTP 202 from money-moving requests. The action has NOT executed — no money moves until a signed-in human confirms the approvalUrl. Watch GET /updates for approval.confirmed or re-check GET /approvals/{approvalId}.",
        "properties": {
          "approval": {
            "$ref": "#/components/schemas/Approval"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "CreditLedgerEntry": {
        "type": "object",
        "required": [
          "id",
          "type",
          "amountCents",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "TOP_UP",
              "HOLD",
              "HOLD_RELEASE",
              "CAPTURE",
              "REFUND",
              "ADJUSTMENT"
            ],
            "description": "TOP_UP adds credits; HOLD reserves available credits into escrow; HOLD_RELEASE returns a hold to available; CAPTURE spends a hold; REFUND/ADJUSTMENT are admin corrections."
          },
          "amountCents": {
            "type": "integer",
            "description": "Signed amount in cents from the perspective of the available balance (negative for HOLD/CAPTURE)"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "holdEntryId": {
            "type": [
              "string",
              "null"
            ],
            "description": "For HOLD_RELEASE/CAPTURE, the originating HOLD entry id"
          },
          "jobofferId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Linked proposal id"
          },
          "contractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "milestoneId": {
            "type": [
              "string",
              "null"
            ]
          },
          "topUpId": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "BillingRecordSummary": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "amountCents",
          "currency",
          "marginBasis",
          "createdAt",
          "invoiceId",
          "creditTopUpId",
          "contractId",
          "milestoneId",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "description": "Billing record kind, e.g. milestone_funding, credit_top_up, data_product_purchase — new kinds may appear; clients should humanize with a fallback."
          },
          "amountCents": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "marginBasis": {
            "type": "string",
            "description": "How the platform margin applied (e.g. standard, zero_margin)"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "invoiceId": {
            "type": [
              "string",
              "null"
            ]
          },
          "creditTopUpId": {
            "type": [
              "string",
              "null"
            ]
          },
          "contractId": {
            "type": [
              "string",
              "null"
            ]
          },
          "milestoneId": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "What was bought — e.g. the data-product listing title"
          }
        }
      },
      "AutoTopUpSettings": {
        "type": "object",
        "required": [
          "enabled",
          "thresholdCents",
          "reloadAmountCents"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "thresholdCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "Reload when the available balance drops below this (persisted as a 32-bit integer)"
          },
          "reloadAmountCents": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 1000000,
            "description": "Amount of the pending reload checkout created when the balance drops below the threshold"
          }
        }
      },
      "GigSummary": {
        "type": "object",
        "required": [
          "gigId",
          "gigType",
          "status",
          "title",
          "budgetCents",
          "expiresAt",
          "createdAt"
        ],
        "properties": {
          "gigId": {
            "type": "string"
          },
          "gigType": {
            "type": "string",
            "enum": [
              "VERIFY",
              "VALIDATE",
              "JUDGE",
              "FILL"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "DISPATCHED",
              "IN_PROGRESS",
              "FULFILLED",
              "VERIFIED",
              "CANCELLED",
              "EXPIRED"
            ]
          },
          "title": {
            "type": "string"
          },
          "budgetCents": {
            "type": "number"
          },
          "projectId": {
            "type": "string"
          },
          "taskId": {
            "type": "string"
          },
          "assigneeUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "GigResult": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GigSummary"
          },
          {
            "type": "object",
            "properties": {
              "verifiedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "result": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Present ONLY once VERIFIED",
                "properties": {
                  "verdict": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "answer": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "confidence": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "raw": {
                    "description": "The full annotation result array"
                  }
                }
              },
              "qc": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "reviewStatus": {
                    "type": "string"
                  },
                  "reviewRating": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "agreementScore": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "reviewedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  }
                }
              },
              "provenance": {
                "type": "object",
                "properties": {
                  "dispatchedBy": {
                    "type": "string",
                    "enum": [
                      "agent"
                    ]
                  },
                  "dispatchedByUserId": {
                    "type": "string"
                  },
                  "agentTokenId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "fulfilledByVettedTalent": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        ]
      },
      "CreditTopUp": {
        "type": "object",
        "required": [
          "id",
          "status",
          "amountCents",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "COMPLETED",
              "EXPIRED",
              "CANCELED",
              "DISPUTED_UNSETTLED"
            ],
            "description": "PENDING = checkout link not paid yet; COMPLETED = paid and credits added, with `dispute` set when a later dispute was recorded; EXPIRED = checkout link lapsed unpaid; CANCELED = abandoned; DISPUTED_UNSETTLED = paid, but the charge was disputed before it settled, so no credits were added. No automatic refund is made."
          },
          "amountCents": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dispute": {
            "type": [
              "object",
              "null"
            ],
            "description": "Stripe dispute on the charge. Set for both unsettled and completed top-ups; a completed top-up may have available credits clawed back. Quote `id` to support.",
            "required": [
              "id",
              "status",
              "reason"
            ],
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Stripe dispute id (du_...)."
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Stripe dispute status."
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Stripe dispute reason."
              }
            }
          }
        }
      },
      "TimeEntry": {
        "type": "object",
        "required": [
          "id",
          "contractId",
          "cellStart",
          "workDate",
          "status",
          "billableSeconds"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "workProjectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "cellStart": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the 10-minute UTC-aligned billing cell"
          },
          "workDate": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "type": "string",
            "enum": [
              "BILLABLE",
              "OVER_LIMIT",
              "EXCLUDED",
              "DISPUTED"
            ]
          },
          "protected": {
            "type": "boolean",
            "description": "Payment protection: tracked evidence intact (manual time is never protected)"
          },
          "trackedOnPlatformSeconds": {
            "type": "integer"
          },
          "trackedOffPlatformSeconds": {
            "type": "integer"
          },
          "manualSeconds": {
            "type": "integer"
          },
          "billableSeconds": {
            "type": "integer"
          },
          "activeSeconds": {
            "type": "integer",
            "description": "Input-backed seconds within tracked time (activity meter numerator)"
          },
          "activityPct": {
            "type": [
              "integer",
              "null"
            ]
          },
          "memo": {
            "type": [
              "string",
              "null"
            ]
          },
          "manualEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "reconciledAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TimeManualEntry": {
        "type": "object",
        "required": [
          "id",
          "contractId",
          "startedAt",
          "endedAt",
          "memo",
          "createdVia",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "workProjectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "endedAt": {
            "type": "string",
            "format": "date-time"
          },
          "memo": {
            "type": "string"
          },
          "createdVia": {
            "type": "string",
            "enum": [
              "WEB",
              "API",
              "MCP",
              "CLI"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TimeSegmentInput": {
        "type": "object",
        "required": [
          "clientSegmentId",
          "kind",
          "startedAt",
          "endedAt"
        ],
        "properties": {
          "clientSegmentId": {
            "type": "string",
            "description": "Device-unique id; replays with the same id are deduplicated"
          },
          "kind": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "IDLE"
            ]
          },
          "contractId": {
            "type": "string"
          },
          "workProjectId": {
            "type": "string"
          },
          "workUnitId": {
            "type": "string"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "endedAt": {
            "type": "string",
            "format": "date-time"
          },
          "activeSeconds": {
            "type": "integer",
            "minimum": 0
          },
          "inputEventsCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Input event COUNTS only — never keystroke content"
          }
        }
      },
      "TimeActivitySampleInput": {
        "type": "object",
        "required": [
          "clientSampleId",
          "startedAt",
          "durationSeconds"
        ],
        "properties": {
          "clientSampleId": {
            "type": "string"
          },
          "app": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "durationSeconds": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "TimeIngestBatchResult": {
        "type": "object",
        "required": [
          "accepted",
          "duplicates",
          "rejected",
          "results"
        ],
        "properties": {
          "accepted": {
            "type": "integer"
          },
          "duplicates": {
            "type": "integer"
          },
          "rejected": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "clientId",
                "accepted"
              ],
              "properties": {
                "clientId": {
                  "type": "string"
                },
                "accepted": {
                  "type": "boolean"
                },
                "duplicate": {
                  "type": "boolean"
                },
                "reason": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "TimeDevice": {
        "type": "object",
        "required": [
          "id",
          "name",
          "platform",
          "status",
          "pairedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "appVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "ACTIVE",
              "REVOKED"
            ]
          },
          "pairedAt": {
            "type": "string",
            "format": "date-time"
          },
          "activatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastSeenAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "TimeStatusSeconds": {
        "type": "object",
        "description": "Recorded (tracked + manual) seconds by cell billing status; unknown statuses are counted in `other`. A cell that crosses the weekly cap mid-cell stays BILLABLE with truncated billable seconds, so its over-cap remainder counts in `billable`, not `overLimit`.",
        "required": [
          "billable",
          "overLimit",
          "excluded",
          "disputed",
          "other"
        ],
        "properties": {
          "billable": {
            "type": "integer"
          },
          "overLimit": {
            "type": "integer"
          },
          "excluded": {
            "type": "integer"
          },
          "disputed": {
            "type": "integer"
          },
          "other": {
            "type": "integer"
          }
        }
      },
      "TimeReviewSeconds": {
        "type": "object",
        "description": "Billable seconds by buyer review state: invoiced, approved (timesheet locked, not invoiced), or pending approval. `invoiced` is reserved: no invoicing path stamps cells yet, so it is currently always 0.",
        "required": [
          "invoiced",
          "approved",
          "pendingApproval"
        ],
        "properties": {
          "invoiced": {
            "type": "integer"
          },
          "approved": {
            "type": "integer"
          },
          "pendingApproval": {
            "type": "integer"
          }
        }
      },
      "TimeWorkerSummaryPage": {
        "type": "object",
        "required": [
          "from",
          "to",
          "totals",
          "source",
          "workers"
        ],
        "properties": {
          "projectId": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "totals": {
            "type": "object",
            "required": [
              "trackedSeconds",
              "manualSeconds",
              "billableSeconds",
              "statusSeconds",
              "reviewSeconds"
            ],
            "properties": {
              "trackedSeconds": {
                "type": "integer"
              },
              "manualSeconds": {
                "type": "integer"
              },
              "billableSeconds": {
                "type": "integer"
              },
              "activityPct": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "statusSeconds": {
                "$ref": "#/components/schemas/TimeStatusSeconds"
              },
              "reviewSeconds": {
                "$ref": "#/components/schemas/TimeReviewSeconds"
              }
            }
          },
          "source": {
            "type": "object",
            "description": "As-of metadata: tells \"no time recorded\" (cellCount 0) apart from stale data (latestReconciledAt).",
            "required": [
              "asOf",
              "latestReconciledAt",
              "cellCount"
            ],
            "properties": {
              "asOf": {
                "type": "string",
                "format": "date-time"
              },
              "latestReconciledAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "cellCount": {
                "type": "integer"
              }
            }
          },
          "workers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "userId",
                "trackedSeconds",
                "manualSeconds",
                "billableSeconds",
                "statusSeconds",
                "reviewSeconds"
              ],
              "properties": {
                "userId": {
                  "type": "string"
                },
                "displayName": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Masked \"First L.\" — personal contact details never returned"
                },
                "trackedSeconds": {
                  "type": "integer"
                },
                "manualSeconds": {
                  "type": "integer"
                },
                "billableSeconds": {
                  "type": "integer"
                },
                "activityPct": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "statusSeconds": {
                  "$ref": "#/components/schemas/TimeStatusSeconds"
                },
                "reviewSeconds": {
                  "$ref": "#/components/schemas/TimeReviewSeconds"
                }
              }
            }
          },
          "finalStatement": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TimeFinalStatement"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "TimeFinalStatement": {
        "type": "object",
        "required": [
          "id",
          "status",
          "intervalStartAt",
          "intervalEndAt",
          "trackedSeconds",
          "inputTrackedSeconds",
          "activeSeconds",
          "manualSeconds",
          "deletedSeconds",
          "activityCount",
          "editEventCount",
          "contentHash"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "SETTLING",
              "READY_FOR_REVIEW",
              "FINALIZED"
            ]
          },
          "intervalStartAt": {
            "type": "string",
            "format": "date-time"
          },
          "intervalEndAt": {
            "type": "string",
            "format": "date-time"
          },
          "settledThroughAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "trackedSeconds": {
            "type": "integer"
          },
          "inputTrackedSeconds": {
            "type": "integer"
          },
          "activeSeconds": {
            "type": "integer"
          },
          "manualSeconds": {
            "type": "integer"
          },
          "deletedSeconds": {
            "type": "integer"
          },
          "activityCount": {
            "type": "integer"
          },
          "editEventCount": {
            "type": "integer"
          },
          "contentHash": {
            "type": "string"
          },
          "finalizedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finalizedByUserId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "WebhookSubscription": {
        "type": "object",
        "required": [
          "id",
          "url",
          "eventTypes",
          "status",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED"
            ],
            "description": "DISABLED means deliveries stopped (auto-disabled after sustained failures); delete and re-create to resume."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "disabledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "disabledReason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  }
}